emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Improve configurability of ox-koma-letter
@ 2013-04-21 17:59 Viktor Rosenfeld
  2013-04-22  8:24 ` Alan Schmitt
  2013-04-22  9:57 ` Rasmus
  0 siblings, 2 replies; 38+ messages in thread
From: Viktor Rosenfeld @ 2013-04-21 17:59 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 390 bytes --]

Hi,

I've hacked the ox-koma-letter exporter to make it more configurable.
See the Changelog of the attached patch, hopefully I've followed the
Changelog guidelines propertly.

Also, I could not find an ox-koma-letter tutorial on Worg. I would be
willing to create such a tutorial, maybe next weekend. Can anybody edit
the contents on Worg or do I need special priviledges?

Cheers, Viktor

[-- Attachment #2: ox-koma-letter.patch --]
[-- Type: text/x-diff, Size: 11197 bytes --]

KOMA scrlttr2 export: Improve export configuration options.

* ox-koma-letter.el (org-koma-letter-sender): New option for
the letter's author.
(org-koma-letter-from-address): Do not set default personal information.
(org-koma-letter-phone-number): Do not set default personal information.
(org-koma-letter-email): New option for the sender's email.
(org-koma-letter-place): Specify the letter's place.
(org-koma-letter-opening): Gendered opening.
(org-koma-letter-closing): More business-like closing
(org-koma-letter-use-subject): Configure the appearance of the
subject line.
(org-koma-letter-use-backaddress): Configure the presence of
the backaddress.
(org-koma-letter-use-foldmarks): Configure the presence of foldmarks.
(org-koma-letter-use-phone): Configure the presence of the
sender's phone number.
(org-koma-letter-use-email): Configure the presence of the
sender's email address.
(org-koma-letter-use-place): Configure the presence of the
letter's place.
(koma-letter): Add new options to koma-letter export backend
(org-koma-letter-template): Better KOMA configuration; support for 
multiple LCO files.

This patch changes the KOMA-letter exporter in four ways:

* Same hotkeys as the LaTeX exporter

Use =L= (instead of =K=) to export to a buffer, =l= (instead of =k=)
to export to a file, and =O= (instead of =o=) to open the PDF file.

This was already suggested by Rasmus
(http://thread.gmane.org/gmane.emacs.orgmode/67026).

* Setting of KOMA variables

LCO files are loaded first and KOMA variables are only set in the
LaTeX output if their value is not nil. This way most configuration
options can be set once in an LCO file and overwritten if needed.

Consider for example an LCO file =DefaultAddress.lco= in
=~/texmf/tex/latex=.

#+BEGIN_SRC latex
\ProvidesFile{DefaultAddress.lco}
\setkomavar{fromname}{Max Mustermann}
\setkomavar{fromaddress}{Musterstraße 1\\12345 Musterstadt}
#+END_SRC

The default address can then be overwritten in the actual letter. Note
the additional country in the address below.

#+LCO: DefaultAddress
#+FROM_ADDRESS: Musterstraße 1\\12345 Musterstadt\\Germany

* Setting of KOMA options

The presence of the sender's phone and email, the letter's place and
subject, as well as foldmarks and the backaddress are
configurable. Consider:

#+OPTIONS: subject:titled place:nil phone:t email:t foldmarks:nil backaddress:nil

Note, that except for =subject=, all options are boolean, e.g., they
accept the values =t= and =nil=. Subject can also be nil to surpress
printing, or otherwise any possible value for the KOMA option subject,
i.e., afteropening, beforeopening, centered, left, right, titled,
underlined, or untitled.

* Multiple LCO files

Multiple LCO files, separated by spaces, can be specified. This way
one can add optional behavior to the letter export. Consider, e.g., an
LCO file with a default address and a simple textual signature:

#+BEGIN_SRC latex
\ProvidesFile{Default.lco}

% default address
\setkomavar{fromname}{Max Mustermann}
\setkomavar{fromaddress}{Musterstraße 1\\12345 Musterstadt}

% default signature
\renewcommand*{\raggedsignature}{\raggedright}
\setkomavar{signature}{\usekomavar{fromname}}
#+END_SRC

And a second LCO file defining a signature graphic:

#+BEGIN_SRC latex
\ProvidesFile{Signed.lco}

% use signature graphic
\usepackage{graphicx}
\setkomavar{signature}{\\[-2.5\baselineskip]\includegraphics{/home/he-sk/org/data/12/441E34-D2DE-4207-9B4A-23A4DA7AF870/Unterschrift.png}\\[-0.9\baselineskip]\usekomavar{fromname}}
#+END_SRC

Then, a signed letter can be created as follows:

#+LCO: Default Signed


diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 1ffb455..31ccd89 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -80,23 +80,38 @@
   :group 'org-export-koma-letter
   :type 'string)
 
-(defcustom org-koma-letter-closing "See you soon,"
-  "Koma-Letter's closing, as a string."
+(defcustom org-koma-letter-sender nil
+  "Sender's name, as a string."
   :group 'org-export-koma-letter
   :type 'string)
 
-(defcustom org-koma-letter-from-address "Somewhere \\ Over the rainbow."
+(defcustom org-koma-letter-from-address nil
   "Sender's address, as a string."
   :group 'org-export-koma-letter
   :type 'string)
 
-(defcustom org-koma-letter-opening "Dear Sir,"
+(defcustom org-koma-letter-phone-number nil
+  "Sender's phone number, as a string."
+  :group 'org-export-koma-letter
+  :type 'string)
+
+(defcustom org-koma-letter-email nil
+  "Sender's email, as a string."
+  :group 'org-export-koma-letter
+  :type 'string)
+
+(defcustom org-koma-letter-place nil
+  "Place from which the letter is sent."
+  :group 'org-export-koma-letter
+  :type 'string)
+
+(defcustom org-koma-letter-opening "Dear Madam or Sir,"
   "Letter's opening, as a string."
   :group 'org-export-koma-letter
   :type 'string)
 
-(defcustom org-koma-letter-phone-number "00-00-00-00"
-  "Sender's phone number, as a string."
+(defcustom org-koma-letter-closing "Sincerely yours,"
+  "Koma-Letter's closing, as a string."
   :group 'org-export-koma-letter
   :type 'string)
 
@@ -105,28 +120,68 @@
   :group 'org-export-koma-letter
   :type 'string)
 
+(defcustom org-koma-letter-use-subject "untitled"
+  "Use the title as the letter's subject."
+  :group 'org-export-koma-letter
+  :type 'string)
+
+(defcustom org-koma-letter-use-backaddress t
+  "Print return address in small line above to address."
+  :group 'org-export-koma-letter
+  :type 'boolean)
+
+(defcustom org-koma-letter-use-foldmarks t
+  "Print foldmarks."
+  :group 'org-export-koma-letter
+  :type 'boolean)
+
+(defcustom org-koma-letter-use-phone t
+  "Print sender's phone number."
+  :group 'org-export-koma-letter
+  :type 'boolean)
+
+(defcustom org-koma-letter-use-email t
+  "Print sender's email address."
+  :group 'org-export-koma-letter
+  :type 'boolean)
+
+(defcustom org-koma-letter-use-place t
+  "Print the letter's place next to the date."
+  :group 'org-export-koma-letter
+  :type 'boolean)
+
 \f
 ;;; Define Back-End
 
 (org-export-define-derived-backend 'koma-letter 'latex
   :options-alist
-  '((:closing "CLOSING" nil org-koma-letter-closing)
+  '((:lco "LCO" nil org-koma-letter-class-option-file)
+    (:sender "SENDER" nil org-koma-letter-sender newline)
     (:from-address "FROM_ADDRESS" nil org-koma-letter-from-address newline)
-    (:lco "LCO" nil org-koma-letter-class-option-file)
-    (:opening "OPENING" nil org-koma-letter-opening)
     (:phone-number "PHONE_NUMBER" nil org-koma-letter-phone-number)
-    (:signature "SIGNATURE" nil nil newline)
-    (:to-address "TO_ADDRESS" nil nil newline))
+    (:email "EMAIL" nil org-koma-letter-email)
+    (:to-address "TO_ADDRESS" nil nil newline)
+    (:place "PLACE" nil org-koma-letter-place)
+    (:opening "OPENING" nil org-koma-letter-opening)
+    (:closing "CLOSING" nil org-koma-letter-closing)
+    (:signature "SIGNATURE" nil org-koma-letter-signature newline)
+
+    (:with-backaddress nil "backaddress" org-koma-letter-use-backaddress)
+    (:with-foldmarks nil "foldmarks" org-koma-letter-use-foldmarks)
+    (:with-phone nil "phone" org-koma-letter-use-phone)
+    (:with-email nil "email" org-koma-letter-use-email)
+    (:with-place nil "place" org-koma-letter-use-place)
+    (:with-subject nil "subject" org-koma-letter-use-subject))
   :translate-alist '((export-block . org-koma-letter-export-block)
 		     (export-snippet . org-koma-letter-export-snippet)
 		     (keyword . org-koma-letter-keyword)
 		     (template . org-koma-letter-template))
   :menu-entry
   '(?k "Export with KOMA Scrlttr2"
-       ((?K "As LaTeX buffer" org-koma-letter-export-as-latex)
-	(?k "As LaTeX file" org-koma-letter-export-to-latex)
+       ((?L "As LaTeX buffer" org-koma-letter-export-as-latex)
+	(?l "As LaTeX file" org-koma-letter-export-to-latex)
 	(?p "As PDF file" org-koma-letter-export-to-pdf)
-	(?O "As PDF file and open"
+	(?o "As PDF file and open"
 	    (lambda (a s v b)
 	      (if a (org-koma-letter-export-to-pdf t s v b)
 		(org-open-file (org-koma-letter-export-to-pdf nil s v b))))))))
@@ -197,22 +252,53 @@ holding export options."
 	     (concat (plist-get info :latex-header)
 		     (plist-get info :latex-header-extra))))
            info)))))
-   ;; Define "From" data.
-   (format "\\setkomavar{fromname}{%s}\n"
-           (org-export-data (plist-get info :author) info))
-   (format "\\setkomavar{fromaddress}{%s}\n" (plist-get info :from-address))
-   (format "\\setkomavar{signature}{%s}\n" (plist-get info :signature))
-   (format "\\setkomavar{fromemail}{%s}\n"
-           (org-export-data (plist-get info :email) info))
-   (format "\\setkomavar{fromphone}{%s}\n" (plist-get info :phone-number))
+   (let ((lco (plist-get info :lco))
+	 (sender (plist-get info :sender))
+	 (from-address (plist-get info :from-address))
+	 (phone-number (plist-get info :phone-number))
+	 (email (plist-get info :email))
+	 (signature (plist-get info :signature)))
+     (concat
+      ;; Letter Class Option File
+      (when lco 
+	(let ((lco-files (split-string lco " "))
+	      (lco-def ""))
+	  (dolist (lco-file lco-files lco-def)
+	    (setq lco-def (format "%s\\LoadLetterOption{%s}\n" lco-def lco-file)))
+	  lco-def))
+      ;; Define "From" data.
+      (when sender (format "\\setkomavar{fromname}{%s}\n" sender))
+      (when from-address (format "\\setkomavar{fromaddress}{%s}\n" from-address))
+      (when phone-number (format "\\setkomavar{fromphone}{%s}\n" phone-number))
+      (when email (format "\\setkomavar{fromemail}{%s}\n" email))
+      (when signature (format "\\setkomavar{signature}{%s}\n" signature))))
    ;; Date.
    (format "\\date{%s}\n" (org-export-data (org-export-get-date info) info))
-   ;; Letter Class Option File
-   (format "\\LoadLetterOption{%s}\n" (plist-get info :lco))
-   ;; Letter start.
+   ;; Place
+   (let ((with-place (plist-get info :with-place))
+	 (place (plist-get info :place)))
+     (when (or place (not with-place))
+       (format "\\setkomavar{place}{%s}\n" (if with-place place ""))))
+   ;; KOMA options
+   (let ((with-backaddress (plist-get info :with-backaddress))
+	 (with-foldmarks (plist-get info :with-foldmarks))
+	 (with-phone (plist-get info :with-phone))
+	 (with-email (plist-get info :with-email)))
+     (concat
+      (format "\\KOMAoption{backaddress}{%s}\n" (if with-backaddress "true" "false"))
+      (format "\\KOMAoption{foldmarks}{%s}\n" (if with-foldmarks "true" "false"))
+      (format "\\KOMAoption{fromphone}{%s}\n" (if with-phone "true" "false"))
+      (format "\\KOMAoption{fromemail}{%s}\n" (if with-email "true" "false"))))
+   ;; Document start
    "\\begin{document}\n\n"
-   (format "\\setkomavar{subject}{%s}\n\n"
-           (org-export-data (plist-get info :title) info))
+   ;; Subject
+   (let ((with-subject (plist-get info :with-subject)))
+     (when with-subject
+       (concat
+	(format "\\KOMAoption{subject}{%s}\n" with-subject)
+	(format "\\setkomavar{subject}{%s}\n\n"
+		(org-export-data (plist-get info :title) info)))))
+   ;; Letter start
    (format "\\begin{letter}{%%\n%s}\n\n"
 	   (or (plist-get info :to-address) "no address given"))
    ;; Opening.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-21 17:59 [PATCH] Improve configurability of ox-koma-letter Viktor Rosenfeld
@ 2013-04-22  8:24 ` Alan Schmitt
  2013-04-22  8:47   ` Nicolas Goaziou
                     ` (2 more replies)
  2013-04-22  9:57 ` Rasmus
  1 sibling, 3 replies; 38+ messages in thread
From: Alan Schmitt @ 2013-04-22  8:24 UTC (permalink / raw)
  To: Viktor Rosenfeld; +Cc: emacs-orgmode

Hi,

Viktor Rosenfeld writes:

> Hi,
>
> I've hacked the ox-koma-letter exporter to make it more configurable.
> See the Changelog of the attached patch, hopefully I've followed the
> Changelog guidelines propertly.

This looks very nice, thanks a lot.

I'm not sure about the procedure to apply this patch, however. Should I
do it myself?

> Also, I could not find an ox-koma-letter tutorial on Worg. I would be
> willing to create such a tutorial, maybe next weekend. Can anybody edit
> the contents on Worg or do I need special priviledges?

You need to ask for write access.

I started writing a tutorial, but I was caught up in too many things and
could not finish it. If you want I can send you privately what I have
written (or I can push it to worg and we can edit it together).

Best,

Alan

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-22  8:24 ` Alan Schmitt
@ 2013-04-22  8:47   ` Nicolas Goaziou
  2013-04-22  9:31     ` Alan Schmitt
  2013-04-22 10:49   ` Viktor Rosenfeld
  2013-05-05 13:35   ` Viktor Rosenfeld
  2 siblings, 1 reply; 38+ messages in thread
From: Nicolas Goaziou @ 2013-04-22  8:47 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Hello,

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> I'm not sure about the procedure to apply this patch, however. Should I
> do it myself?

You're the file maintainer, aren't you? :)


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-22  8:47   ` Nicolas Goaziou
@ 2013-04-22  9:31     ` Alan Schmitt
  2013-04-22 10:57       ` Viktor Rosenfeld
  0 siblings, 1 reply; 38+ messages in thread
From: Alan Schmitt @ 2013-04-22  9:31 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Nicolas Goaziou writes:

> Hello,
>
> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> I'm not sure about the procedure to apply this patch, however. Should I
>> do it myself?
>
> You're the file maintainer, aren't you? :)

;-)

A couple notes about the patch:
- Could you create it using "git format-patch"? This way we'll have
more metadata in the commit.
- I think there is an issue with the handling of signatures. I tried
with an old letter that uses a LCO with a graphical signature in it, but
it gets overridden upon export. Here is the generated TeX.

#+BEGIN_SRC latex
\LoadLetterOption{InriaRennesFR}
\setkomavar{signature}{\usekomavar{fromname}}
#+END_SRC

It seems to come from this part of the patch:

#+BEGIN_SRC emacs-lisp
	 (signature (plist-get info :signature)))
     (concat
      ;; Letter Class Option File
      (when lco 
	(let ((lco-files (split-string lco " "))
	      (lco-def ""))
	  (dolist (lco-file lco-files lco-def)
	    (setq lco-def (format "%s\\LoadLetterOption{%s}\n" lco-def lco-file)))
	  lco-def))
      ;; Define "From" data.
      (when sender (format "\\setkomavar{fromname}{%s}\n" sender))
      (when from-address (format "\\setkomavar{fromaddress}{%s}\n" from-address))
      (when phone-number (format "\\setkomavar{fromphone}{%s}\n" phone-number))
      (when email (format "\\setkomavar{fromemail}{%s}\n" email))
      (when signature (format "\\setkomavar{signature}{%s}\n" signature))))
#+END_SRC

If signature is set for some reason (and it seems to be by default),
then it will override what is in the LCO. I have not found a way to
set the options such that the signature from the LCO gets picked up.

Alan

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-21 17:59 [PATCH] Improve configurability of ox-koma-letter Viktor Rosenfeld
  2013-04-22  8:24 ` Alan Schmitt
@ 2013-04-22  9:57 ` Rasmus
  2013-04-22 11:27   ` Viktor Rosenfeld
  2013-04-22 17:13   ` Bastien
  1 sibling, 2 replies; 38+ messages in thread
From: Rasmus @ 2013-04-22  9:57 UTC (permalink / raw)
  To: emacs-orgmode

Viktor,

Looks nice!

> Also, I could not find an ox-koma-letter tutorial on Worg. I would be
> willing to create such a tutorial, maybe next weekend. Can anybody edit
> the contents on Worg or do I need special priviledges?

Ask Bastien or perhaps Carsten now for write access (you need to
provide your public key).  I can look through it when uploaded.

> KOMA scrlttr2 export: Improve export configuration options.
>
> [...]
> 
> * Same hotkeys as the LaTeX exporter
>
> Use =L= (instead of =K=) to export to a buffer, =l= (instead of =k=)
> to export to a file, and =O= (instead of =o=) to open the PDF file.
>
> This was already suggested by Rasmus
> (http://thread.gmane.org/gmane.emacs.orgmode/67026).

Thanks.  And sorry for not providing a final patch myself; school/work
suddenly exploded.

> * Setting of KOMA variables
>
> LCO files are loaded first and KOMA variables are only set in the
> LaTeX output if their value is not nil. This way most configuration
> options can be set once in an LCO file and overwritten if needed.

This was certainly an outstanding bug that I've also been annoyed with.


> [...]
> * Setting of KOMA options
>
> The presence of the sender's phone and email, the letter's place and
> subject, as well as foldmarks and the backaddress are
> configurable. Consider:
>
> #+OPTIONS: subject:titled place:nil phone:t email:t foldmarks:nil backaddress:nil

In a similar spirit to subject is firsthead.  First head is displayed
by default in scrlttr2 as far as I recall, which is annoying.

If we make foldmark an option should it not be a string accepting
values from "Table 4.3.: Combinable values for the configuration of
folding marks with option foldmarks" in the KOMA-Script manual?

> Note, that except for =subject=, all options are boolean, e.g., they
> accept the values =t= and =nil=. Subject can also be nil to surpress
> printing, or otherwise any possible value for the KOMA option subject,
> i.e., afteropening, beforeopening, centered, left, right, titled,
> underlined, or untitled.

I wasn't aware of these options.  Thanks.

> * Multiple LCO files
>
> Multiple LCO files, separated by spaces, can be specified. This way
> one can add optional behavior to the letter export. Consider, e.g., an
> LCO file with a default address and a simple textual signature:

Cool.


> diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
> index 1ffb455..31ccd89 100644
> --- a/contrib/lisp/ox-koma-letter.el
> +++ b/contrib/lisp/ox-koma-letter.el
> @@ -80,23 +80,38 @@
>    :group 'org-export-koma-letter
>    :type 'string)
>  
> -(defcustom org-koma-letter-closing "See you soon,"
> -  "Koma-Letter's closing, as a string."
> +(defcustom org-koma-letter-sender nil

I agree with getting rid of silly defaults. 


  
> +(defcustom org-koma-letter-opening "Dear Madam or Sir,"
>    "Letter's opening, as a string."
>    :group 'org-export-koma-letter
>    :type 'string)

While I also mainly write English letters I don't think we need to
assume everyone does.  I'd also opt for a default nil here.

  
> +(defcustom org-koma-letter-closing "Sincerely yours,"
> +  "Koma-Letter's closing, as a string."
>    :group 'org-export-koma-letter
>    :type 'string)

ditto.
  
> +(defcustom org-koma-letter-use-subject "untitled"
> +  "Use the title as the letter's subject."
> +  :group 'org-export-koma-letter
> +  :type 'string)

Perhaps the default should depend on whether a title is present?

> +(defcustom org-koma-letter-use-foldmarks t
> +  "Print foldmarks."
> +  :group 'org-export-koma-letter
> +  :type 'boolean)
> +
> +(defcustom org-koma-letter-use-phone t
> +  "Print sender's phone number."
> +  :group 'org-export-koma-letter
> +  :type 'boolean)
> +
> +(defcustom org-koma-letter-use-email t
> +  "Print sender's email address."
> +  :group 'org-export-koma-letter
> +  :type 'boolean)
> +
> +(defcustom org-koma-letter-use-place t
> +  "Print the letter's place next to the date."
> +  :group 'org-export-koma-letter
> +  :type 'boolean)
> +

Sorry for not testing this myself, but what is the behavior if
e.g. org-koma-letter-use-place is t but I didn't specify a place?
Will it print a nil or nothing?


>    '(?k "Export with KOMA Scrlttr2"
> -       ((?K "As LaTeX buffer" org-koma-letter-export-as-latex)
> -	(?k "As LaTeX file" org-koma-letter-export-to-latex)
> +       ((?L "As LaTeX buffer" org-koma-letter-export-as-latex)
> +	(?l "As LaTeX file" org-koma-letter-export-to-latex)
>  	(?p "As PDF file" org-koma-letter-export-to-pdf)
> -	(?O "As PDF file and open"
> +	(?o "As PDF file and open"
>  	    (lambda (a s v b)

Another approach (which I also somehow like) is to put it under the
LaTeX menu.  E.g. like beamer or like org-ravel ¹  

> +   (let ((with-place (plist-get info :with-place))
> +	 (place (plist-get info :place)))
> +     (when (or place (not with-place)) 
> +       (format "\\setkomavar{place}{%s}\n" (if with-place place ""))))

Wouldn't this work better: E.g. it wouldn't allow a place when place
is nil or when with-place is nil?

(when (and place (not with-place))
  (format "\\setkomavar{place}{%s}\n" place ))



> +   ;; KOMA options
> +   (let ((with-backaddress (plist-get info :with-backaddress))
> +	 (with-foldmarks (plist-get info :with-foldmarks))
> +	 (with-phone (plist-get info :with-phone))
> +	 (with-email (plist-get info :with-email)))
> +     (concat
> +      (format "\\KOMAoption{backaddress}{%s}\n" (if with-backaddress "true" "false"))
> +      (format "\\KOMAoption{foldmarks}{%s}\n" (if with-foldmarks "true" "false"))
> +      (format "\\KOMAoption{fromphone}{%s}\n" (if with-phone "true" "false"))
> +      (format "\\KOMAoption{fromemail}{%s}\n" (if with-email "true"
> "false"))))

Relating to configurable foldmarks:

(if with-foldmarks
        (format "\\KOMAoption{foldmarks}{%s}\n" (if foldmarks
        foldmarks true)))

(untested).

–Rasmus

Footnotes: 
 ¹   https://github.com/chasberry/orgmode-accessories

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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-22  8:24 ` Alan Schmitt
  2013-04-22  8:47   ` Nicolas Goaziou
@ 2013-04-22 10:49   ` Viktor Rosenfeld
  2013-05-05 13:35   ` Viktor Rosenfeld
  2 siblings, 0 replies; 38+ messages in thread
From: Viktor Rosenfeld @ 2013-04-22 10:49 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Hi Alan,

Alan Schmitt wrote:

> > Also, I could not find an ox-koma-letter tutorial on Worg. I would be
> > willing to create such a tutorial, maybe next weekend. Can anybody edit
> > the contents on Worg or do I need special priviledges?
> 
> You need to ask for write access.

Will do.
 
> I started writing a tutorial, but I was caught up in too many things and
> could not finish it. If you want I can send you privately what I have
> written (or I can push it to worg and we can edit it together).

I'm fine with either way. But if you push to worg, please add a line at
the top that the koma exporter is a work in progress.

Cheers,
Viktor

> 
> Best,
> 
> Alan
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-22  9:31     ` Alan Schmitt
@ 2013-04-22 10:57       ` Viktor Rosenfeld
  2013-04-22 12:06         ` Alan Schmitt
  0 siblings, 1 reply; 38+ messages in thread
From: Viktor Rosenfeld @ 2013-04-22 10:57 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Hi Alan,

Alan Schmitt wrote:

> A couple notes about the patch:
> - Could you create it using "git format-patch"? This way we'll have
> more metadata in the commit.

I actually did that first and liked it more because then the patch was
split into more logical blocks (nine patches in total). However, I did
not add correct changelog entries to the commits. Should I resend the
individual patches nevertheless? I could add/change the commit message
manually in the email, I suppose.

> - I think there is an issue with the handling of signatures. I tried
> with an old letter that uses a LCO with a graphical signature in it, but
> it gets overridden upon export. Here is the generated TeX.
> 
> #+BEGIN_SRC latex
> \LoadLetterOption{InriaRennesFR}
> \setkomavar{signature}{\usekomavar{fromname}}
> #+END_SRC
> 

Have you tried clearing the signature?

#+BEGIN_SRC emacs-lisp
(setq org-koma-letter-signature nil)
#+END_SRC

Cheers,
Viktor

> 
> It seems to come from this part of the patch:
> 
> #+BEGIN_SRC emacs-lisp
> 	 (signature (plist-get info :signature)))
>      (concat
>       ;; Letter Class Option File
>       (when lco 
> 	(let ((lco-files (split-string lco " "))
> 	      (lco-def ""))
> 	  (dolist (lco-file lco-files lco-def)
> 	    (setq lco-def (format "%s\\LoadLetterOption{%s}\n" lco-def lco-file)))
> 	  lco-def))
>       ;; Define "From" data.
>       (when sender (format "\\setkomavar{fromname}{%s}\n" sender))
>       (when from-address (format "\\setkomavar{fromaddress}{%s}\n" from-address))
>       (when phone-number (format "\\setkomavar{fromphone}{%s}\n" phone-number))
>       (when email (format "\\setkomavar{fromemail}{%s}\n" email))
>       (when signature (format "\\setkomavar{signature}{%s}\n" signature))))
> #+END_SRC
> 
> If signature is set for some reason (and it seems to be by default),
> then it will override what is in the LCO. I have not found a way to
> set the options such that the signature from the LCO gets picked up.
> 
> Alan
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-22  9:57 ` Rasmus
@ 2013-04-22 11:27   ` Viktor Rosenfeld
  2013-04-22 12:09     ` Rasmus
  2013-04-22 17:13   ` Bastien
  1 sibling, 1 reply; 38+ messages in thread
From: Viktor Rosenfeld @ 2013-04-22 11:27 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Hi Rasmus,

Rasmus wrote:

> > * Setting of KOMA options
> >
> > The presence of the sender's phone and email, the letter's place and
> > subject, as well as foldmarks and the backaddress are
> > configurable. Consider:
> >
> > #+OPTIONS: subject:titled place:nil phone:t email:t foldmarks:nil backaddress:nil
> 
> In a similar spirit to subject is firsthead.  First head is displayed
> by default in scrlttr2 as far as I recall, which is annoying.

Is firsthead something that you change on a letter-by-letter basis? Or
do you configure it once for your letters and never change it? In the
latter case the configuration can be moved of to an LCO file. In the
former case an option would be nice. I had to actually change the
options I introduced so far for different letters (e.g., I don't want
foldmarks if I send the letter by email). 

> If we make foldmark an option should it not be a string accepting
> values from "Table 4.3.: Combinable values for the configuration of
> folding marks with option foldmarks" in the KOMA-Script manual?

Same as above. If I read the scrguide correctly, the foldmark variable
can be set multiple times, e.g.,

#+BEGIN_SRC latex
\KOMAoption{foldmarks}{blmtP}
\KOMAoption{foldmarks}{true}
#+END_SRC

The first line sets the behavior (and could be moved to an LCO file),
the second line can be used to switch foldmarks on or off (and could be
set by the exporter). Haven't tried this though.

> [...]
> > +(defcustom org-koma-letter-opening "Dear Madam or Sir,"
> >    "Letter's opening, as a string."
> >    :group 'org-export-koma-letter
> >    :type 'string)
> 
> While I also mainly write English letters I don't think we need to
> assume everyone does.  I'd also opt for a default nil here.

Fair enough.

> [...]
> > +(defcustom org-koma-letter-use-subject "untitled"
> > +  "Use the title as the letter's subject."
> > +  :group 'org-export-koma-letter
> > +  :type 'string)
> 
> Perhaps the default should depend on whether a title is present?

The way I understand the org exporter, a title is always present. If not
explicitly set using #+TITLE it defaults to the file name or the org
heading.

> [...]
> > +(defcustom org-koma-letter-use-place t
> > +  "Print the letter's place next to the date."
> > +  :group 'org-export-koma-letter
> > +  :type 'boolean)
> > +
> 
> Sorry for not testing this myself, but what is the behavior if
> e.g. org-koma-letter-use-place is t but I didn't specify a place?
> Will it print a nil or nothing?

It will print nil. Maybe this variable should also be configured to nil
then.
 
> 
> >    '(?k "Export with KOMA Scrlttr2"
> > -       ((?K "As LaTeX buffer" org-koma-letter-export-as-latex)
> > -	(?k "As LaTeX file" org-koma-letter-export-to-latex)
> > +       ((?L "As LaTeX buffer" org-koma-letter-export-as-latex)
> > +	(?l "As LaTeX file" org-koma-letter-export-to-latex)
> >  	(?p "As PDF file" org-koma-letter-export-to-pdf)
> > -	(?O "As PDF file and open"
> > +	(?o "As PDF file and open"
> >  	    (lambda (a s v b)
> 
> Another approach (which I also somehow like) is to put it under the
> LaTeX menu.  E.g. like beamer or like org-ravel ¹  

I didn't know this was possible. I don't care either way, but I suppose
an advantage would be that some commands could be then consolidated to
save space.
 
> > +   (let ((with-place (plist-get info :with-place))
> > +	 (place (plist-get info :place)))
> > +     (when (or place (not with-place)) 
> > +       (format "\\setkomavar{place}{%s}\n" (if with-place place ""))))
> 
> Wouldn't this work better: E.g. it wouldn't allow a place when place
> is nil or when with-place is nil?
> 
> (when (and place (not with-place))
>   (format "\\setkomavar{place}{%s}\n" place ))

This will print the place if it is configured somewhere, even if 
=place:nil= is set in #+OPTIONS. Note that I use the empty string "" to
surpress the space in my code. For example, I have in my LCO file

#+BEGIN_SRC latex
\setkomavar{place}{Berlin}
#+END_SRC

That is, the space is usually printed in every letter. 

If I use #+OPTIONS: place:nil in a particular letter, the following code
is emitted:

#+BEGIN_SRC latex
\LoadLetterOption{myletter.lco} % place is set here
\setkomavar{place}{}            % this surpresses the printing of place
#+END_SRC

> > +   ;; KOMA options
> > +   (let ((with-backaddress (plist-get info :with-backaddress))
> > +	 (with-foldmarks (plist-get info :with-foldmarks))
> > +	 (with-phone (plist-get info :with-phone))
> > +	 (with-email (plist-get info :with-email)))
> > +     (concat
> > +      (format "\\KOMAoption{backaddress}{%s}\n" (if with-backaddress "true" "false"))
> > +      (format "\\KOMAoption{foldmarks}{%s}\n" (if with-foldmarks "true" "false"))
> > +      (format "\\KOMAoption{fromphone}{%s}\n" (if with-phone "true" "false"))
> > +      (format "\\KOMAoption{fromemail}{%s}\n" (if with-email "true"
> > "false"))))
> 
> Relating to configurable foldmarks:
> 
> (if with-foldmarks
>         (format "\\KOMAoption{foldmarks}{%s}\n" (if foldmarks
>         foldmarks true)))
> 
> (untested).

I would rather adapt the with-foldmarks option to accept a string rather than
adding another foldmarks variable.

Cheers,
Viktor

> 
> –Rasmus
> 
> Footnotes: 
>  ¹   https://github.com/chasberry/orgmode-accessories
> 
> -- 
> When the facts change, I change my mind. What do you do, sir?
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-22 10:57       ` Viktor Rosenfeld
@ 2013-04-22 12:06         ` Alan Schmitt
  2013-04-22 19:14           ` Viktor Rosenfeld
  0 siblings, 1 reply; 38+ messages in thread
From: Alan Schmitt @ 2013-04-22 12:06 UTC (permalink / raw)
  To: Viktor Rosenfeld; +Cc: emacs-orgmode

Viktor Rosenfeld writes:

> Hi Alan,
>
> Alan Schmitt wrote:
>
>> A couple notes about the patch:
>> - Could you create it using "git format-patch"? This way we'll have
>> more metadata in the commit.
>
> I actually did that first and liked it more because then the patch was
> split into more logical blocks (nine patches in total). However, I did
> not add correct changelog entries to the commits. Should I resend the
> individual patches nevertheless? I could add/change the commit message
> manually in the email, I suppose.

Or you could do a git rebase interactive to merge all the commits
together.

>> - I think there is an issue with the handling of signatures. I tried
>> with an old letter that uses a LCO with a graphical signature in it, but
>> it gets overridden upon export. Here is the generated TeX.
>> 
>> #+BEGIN_SRC latex
>> \LoadLetterOption{InriaRennesFR}
>> \setkomavar{signature}{\usekomavar{fromname}}
>> #+END_SRC
>> 
>
> Have you tried clearing the signature?
>
> #+BEGIN_SRC emacs-lisp
> (setq org-koma-letter-signature nil)
> #+END_SRC

Yes, I changed it globally and I still get the same thing. I also
tried doing a

#+BEGIN_SRC org
#+signature: ""
#+END_SRC

and it inserts it in the LaTeX file as such, after my LCO declaration.

Alan

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-22 11:27   ` Viktor Rosenfeld
@ 2013-04-22 12:09     ` Rasmus
  2013-04-22 19:22       ` Viktor Rosenfeld
  0 siblings, 1 reply; 38+ messages in thread
From: Rasmus @ 2013-04-22 12:09 UTC (permalink / raw)
  To: emacs-orgmode


Viktor,

>> In a similar spirit to subject is firsthead.  First head is displayed
>> by default in scrlttr2 as far as I recall, which is annoying.
>
> Is firsthead something that you change on a letter-by-letter basis? Or
> do you configure it once for your letters and never change it? In the
> latter case the configuration can be moved of to an LCO file. In the
> former case an option would be nice. I had to actually change the
> options I introduced so far for different letters (e.g., I don't want
> foldmarks if I send the letter by email). 

How I use scrlttr2: I rarely use firsthead as I find ugly.  I use
firstfoot all of the time and I change it regularly.  E.g. for some
letters I include bank addresse.  Still, I see your point.

>> If we make foldmark an option should it not be a string accepting
>> values from "Table 4.3.: Combinable values for the configuration of
>> folding marks with option foldmarks" in the KOMA-Script manual?
>
> Same as above. If I read the scrguide correctly, the foldmark variable
> can be set multiple times, e.g.,
> #+BEGIN_SRC latex
> \KOMAoption{foldmarks}{blmtP}
> \KOMAoption{foldmarks}{true}
> #+END_SRC

This is true.

> The first line sets the behavior (and could be moved to an LCO file),
> the second line can be used to switch foldmarks on or off (and could be
> set by the exporter). Haven't tried this though.

Yeah, I guess it's true.  Still, since foldmarks depends on which
envelopes you have at hand it might make sense to have it accept a
string.  In lisp-terms a string is still t.  On the other hand the
current approach is consistent with your approach above so that's a
merit.


>> [...]
>> > +(defcustom org-koma-letter-use-subject "untitled"
>> > +  "Use the title as the letter's subject."
>> > +  :group 'org-export-koma-letter
>> > +  :type 'string)
>> 
>> Perhaps the default should depend on whether a title is present?
>
> The way I understand the org exporter, a title is always present. If not
> explicitly set using #+TITLE it defaults to the file name or the org
> heading.

Could be.  It seems you are right.  In the 'main' LaTeX exporter a
\maketitle is inserted only if title is not nil:

#+begin_src emacs-lisp
;; snip from ox-latex.el, Org-mode version 8.0-pre (release_8.0-pre-523-g7248fb @ /usr/share/emacs/site-lisp/org/)
     (format "\\title{%s}\n" title)
;;   [...]
     (org-element-normalize-string
      (cond ((string= "" title) nil)
	    ((not (stringp org-latex-title-command)) nil)
	    ((string-match "\\(?:[^%]\\|^\\)%s"
			   org-latex-title-command)
	     (format org-latex-title-command title))
	    (t org-latex-title-command)))
     ;; Table of contents.
#+end_src

>> Another approach (which I also somehow like) is to put it under the
>> LaTeX menu.  E.g. like beamer or like org-ravel ¹  
>
> I didn't know this was possible. I don't care either way, but I suppose
> an advantage would be that some commands could be then consolidated to
> save space.

I slightly prefer the "org-ravel" mode of adding it to LaTeX ("l").
It make sense in the way that Beamer is also there.  I don't know if
there exists an official opinion on such practices.
  
>> > +   (let ((with-place (plist-get info :with-place))
>> > +	 (place (plist-get info :place)))
>> > +     (when (or place (not with-place)) 
>> > +       (format "\\setkomavar{place}{%s}\n" (if with-place place ""))))
>> 
>> Wouldn't this work better: E.g. it wouldn't allow a place when place
>> is nil or when with-place is nil?
>> 
>> (when (and place (not with-place))
>>   (format "\\setkomavar{place}{%s}\n" place ))
>
> This will print the place if it is configured somewhere, even if 
> =place:nil= is set in #+OPTIONS.

I see.  I wasn't thinking of the possibility you outline below as I
would configure the variable with my default location (which
unfortunately isn't Berlin).

> Note that I use the empty string "" to
> surpress the space in my code. For example, I have in my LCO file
> #+BEGIN_SRC latex
> \setkomavar{place}{Berlin}
> #+END_SRC
>
> That is, the space is usually printed in every letter. 
>
> If I use #+OPTIONS: place:nil in a particular letter, the following code
> is emitted:
> #+BEGIN_SRC latex
> \LoadLetterOption{myletter.lco} % place is set here
> \setkomavar{place}{}            % this surpresses the printing of place
> #+END_SRC



> I would rather adapt the with-foldmarks option to accept a string rather than
> adding another foldmarks variable.

Agree.  I think it shold.  It's almost "free" to add since a string is
true in both and Emacs lisp sense and a scrlttr2 sense (in this case).

Thanks!

–Rasmus


-- 
And let me remind you also that moderation in the pursuit of justice
is no virtue

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-22  9:57 ` Rasmus
  2013-04-22 11:27   ` Viktor Rosenfeld
@ 2013-04-22 17:13   ` Bastien
  1 sibling, 0 replies; 38+ messages in thread
From: Bastien @ 2013-04-22 17:13 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Hi Viktor,

Rasmus <rasmus@gmx.us> writes:

> Ask Bastien or perhaps Carsten now for write access (you need to
> provide your public key).  I can look through it when uploaded.

Please send me your public key (in private) and I'll add you to Worg.

Best,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-22 12:06         ` Alan Schmitt
@ 2013-04-22 19:14           ` Viktor Rosenfeld
  2013-04-23  6:40             ` Alan Schmitt
  2013-04-23  7:28             ` Alan Schmitt
  0 siblings, 2 replies; 38+ messages in thread
From: Viktor Rosenfeld @ 2013-04-22 19:14 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1302 bytes --]

Hi Alan,

Alan Schmitt wrote:

> Or you could do a git rebase interactive to merge all the commits
> together.

Wow, this is great! I didn't know that you can modify the commit history
so easily. I have attached four patches to this mail which correspond to
the four points in my earlier email. They have to be applied
consecutively.

> >> - I think there is an issue with the handling of signatures. I tried
> >> with an old letter that uses a LCO with a graphical signature in it, but
> >> it gets overridden upon export. Here is the generated TeX.
> >> 
> >> #+BEGIN_SRC latex
> >> \LoadLetterOption{InriaRennesFR}
> >> \setkomavar{signature}{\usekomavar{fromname}}
> >> #+END_SRC
> >> 
> >
> > Have you tried clearing the signature?
> >
> > #+BEGIN_SRC emacs-lisp
> > (setq org-koma-letter-signature nil)
> > #+END_SRC
> 
> Yes, I changed it globally and I still get the same thing. I also
> tried doing a
> 
> #+BEGIN_SRC org
> #+signature: ""
> #+END_SRC
> 
> and it inserts it in the LaTeX file as such, after my LCO declaration.

I can't reproduce this. I have attached a minimal letter as an example.
If I evaluate the emacs-lisp block and export it I can see a graphic
signature that is defined in `Signed.lco' in my `texmf' directory. What
happens on your end?

Cheers,
Viktor

> 
> Alan
> 

[-- Attachment #2: 0001-ox-koma-letter-Use-same-hotkeys-as-LaTeX-export.patch --]
[-- Type: text/plain, Size: 1292 bytes --]

From 02727b4259b2530d7e878aeaed6b2d235d271f2a Mon Sep 17 00:00:00 2001
From: Viktor Rosenfeld <hesk@cartman>
Date: Sun, 21 Apr 2013 13:40:09 +0200
Subject: [PATCH 1/4] ox-koma-letter: Use same hotkeys as LaTeX export

  * ox-koma-letter.el (koma-letter): Use `L' to export to LaTeX
  buffer, `l' to export to LaTeX file, and `o' to export to PDF
  file and open.

Patch suggested by Rasmus.
---
 contrib/lisp/ox-koma-letter.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 1ffb455..d8d32e7 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -123,10 +123,10 @@
 		     (template . org-koma-letter-template))
   :menu-entry
   '(?k "Export with KOMA Scrlttr2"
-       ((?K "As LaTeX buffer" org-koma-letter-export-as-latex)
-	(?k "As LaTeX file" org-koma-letter-export-to-latex)
+       ((?L "As LaTeX buffer" org-koma-letter-export-as-latex)
+	(?l "As LaTeX file" org-koma-letter-export-to-latex)
 	(?p "As PDF file" org-koma-letter-export-to-pdf)
-	(?O "As PDF file and open"
+	(?o "As PDF file and open"
 	    (lambda (a s v b)
 	      (if a (org-koma-letter-export-to-pdf t s v b)
 		(org-open-file (org-koma-letter-export-to-pdf nil s v b))))))))
-- 
1.8.2


[-- Attachment #3: 0002-ox-koma-letter.el-Set-LCO-option-before-other-KOMA-v.patch --]
[-- Type: text/plain, Size: 5697 bytes --]

From 1513beb2ba4aa847eaeb3f5e9c86414e7f8d5cd3 Mon Sep 17 00:00:00 2001
From: Viktor Rosenfeld <hesk@cartman>
Date: Sun, 21 Apr 2013 13:41:22 +0200
Subject: [PATCH 2/4] ox-koma-letter.el: Set LCO option before other KOMA
 variables

  * ox-koma-letter.el (org-koma-letter-closing): More
  business-like closing.
  (org-koma-letter-from-address): Do not set default personal
  information.
  (org-koma-letter-opening): Gendered opening.
  (org-koma-letter-phone-number): Do not set default personal
  information.
  (org-koma-letter-sender): Use `#+SENDER:' instead of
  `#+AUTHOR:' because the latter is always set by the LaTeX
  exporter.
  (org-koma-letter-email): Duplicte `#+EMAIL:' in this exporter
  because it is always set by the LaTeX exporter.
  (koma-letter): Add additional `#+SENDER:' and `#+EMAIL:' to
  exporter (see above).
  (org-koma-letter-template): Set LCO before evaluating other
  KOMA variables if they are set; add `#+SENDER:' and `#+EMAIL:'
  to template (see above).

The LCO file is set loaded first and KOMA variables are only set if
their value is not `nil'.

Example:

  #+LCO: Default
  #+SIGNATURE: A friend

will result in the following LaTeX code:

  #+BEGIN_SRC latex
  \LoadLetterOption{Default}        % LCO file, with default signature
  \setkomavar{signature}{A friend}  % Overwrite signature
  #+END_SRC

Other KOMA variables defined in the LCO file, e.g., `fromaddress', will
not be overwritten.
---
 contrib/lisp/ox-koma-letter.el | 55 +++++++++++++++++++++++++++---------------
 1 file changed, 36 insertions(+), 19 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index d8d32e7..5397cf0 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -80,22 +80,22 @@
   :group 'org-export-koma-letter
   :type 'string)
 
-(defcustom org-koma-letter-closing "See you soon,"
+(defcustom org-koma-letter-closing "Sincerely yours,"
   "Koma-Letter's closing, as a string."
   :group 'org-export-koma-letter
   :type 'string)
 
-(defcustom org-koma-letter-from-address "Somewhere \\ Over the rainbow."
+(defcustom org-koma-letter-from-address nil
   "Sender's address, as a string."
   :group 'org-export-koma-letter
   :type 'string)
 
-(defcustom org-koma-letter-opening "Dear Sir,"
+(defcustom org-koma-letter-opening "Dear Madam or Sir,"
   "Letter's opening, as a string."
   :group 'org-export-koma-letter
   :type 'string)
 
-(defcustom org-koma-letter-phone-number "00-00-00-00"
+(defcustom org-koma-letter-phone-number nil
   "Sender's phone number, as a string."
   :group 'org-export-koma-letter
   :type 'string)
@@ -105,18 +105,30 @@
   :group 'org-export-koma-letter
   :type 'string)
 
+(defcustom org-koma-letter-sender nil
+  "Sender's name, as a string."
+  :group 'org-export-koma-letter
+  :type 'string)
+
+(defcustom org-koma-letter-email nil
+  "Sender's email, as a string."
+  :group 'org-export-koma-letter
+  :type 'string)
+
 \f
 ;;; Define Back-End
 
 (org-export-define-derived-backend 'koma-letter 'latex
   :options-alist
-  '((:closing "CLOSING" nil org-koma-letter-closing)
+  '((:lco "LCO" nil org-koma-letter-class-option-file)
+    (:sender "SENDER" nil org-koma-letter-sender newline)
     (:from-address "FROM_ADDRESS" nil org-koma-letter-from-address newline)
-    (:lco "LCO" nil org-koma-letter-class-option-file)
-    (:opening "OPENING" nil org-koma-letter-opening)
     (:phone-number "PHONE_NUMBER" nil org-koma-letter-phone-number)
-    (:signature "SIGNATURE" nil nil newline)
-    (:to-address "TO_ADDRESS" nil nil newline))
+    (:email "EMAIL" nil org-koma-letter-email)
+    (:to-address "TO_ADDRESS" nil nil newline)
+    (:opening "OPENING" nil org-koma-letter-opening)
+    (:closing "CLOSING" nil org-koma-letter-closing)
+    (:signature "SIGNATURE" nil org-koma-letter-signature newline))
   :translate-alist '((export-block . org-koma-letter-export-block)
 		     (export-snippet . org-koma-letter-export-snippet)
 		     (keyword . org-koma-letter-keyword)
@@ -197,18 +209,23 @@ holding export options."
 	     (concat (plist-get info :latex-header)
 		     (plist-get info :latex-header-extra))))
            info)))))
-   ;; Define "From" data.
-   (format "\\setkomavar{fromname}{%s}\n"
-           (org-export-data (plist-get info :author) info))
-   (format "\\setkomavar{fromaddress}{%s}\n" (plist-get info :from-address))
-   (format "\\setkomavar{signature}{%s}\n" (plist-get info :signature))
-   (format "\\setkomavar{fromemail}{%s}\n"
-           (org-export-data (plist-get info :email) info))
-   (format "\\setkomavar{fromphone}{%s}\n" (plist-get info :phone-number))
+   (let ((lco (plist-get info :lco))
+	 (sender (plist-get info :sender))
+	 (from-address (plist-get info :from-address))
+	 (phone-number (plist-get info :phone-number))
+	 (email (plist-get info :email))
+	 (signature (plist-get info :signature)))
+     (concat
+      ;; Letter Class Option File
+      (when lco (format "\\LoadLetterOption{%s}\n" lco))
+      ;; Define "From" data.
+      (when sender (format "\\setkomavar{fromname}{%s}\n" sender))
+      (when from-address (format "\\setkomavar{fromaddress}{%s}\n" from-address))
+      (when phone-number (format "\\setkomavar{fromphone}{%s}\n" phone-number))
+      (when email (format "\\setkomavar{fromemail}{%s}\n" email))
+      (when signature (format "\\setkomavar{signature}{%s}\n" signature))))
    ;; Date.
    (format "\\date{%s}\n" (org-export-data (org-export-get-date info) info))
-   ;; Letter Class Option File
-   (format "\\LoadLetterOption{%s}\n" (plist-get info :lco))
    ;; Letter start.
    "\\begin{document}\n\n"
    (format "\\setkomavar{subject}{%s}\n\n"
-- 
1.8.2


[-- Attachment #4: 0003-ox-koma-letter-Export-options-to-control-letter.patch --]
[-- Type: text/plain, Size: 6289 bytes --]

From 1cb50d2db617f79477365db2bc6251a59636d9bf Mon Sep 17 00:00:00 2001
From: Viktor Rosenfeld <hesk@cartman>
Date: Sun, 21 Apr 2013 16:34:35 +0200
Subject: [PATCH 3/4] ox-koma-letter: Export options to control letter

  * ox-koma-letter.el ((org-koma-letter-use-subject):
  Configure printing of subject line.
  (org-koma-letter-use-backaddress): Configure presence of back
  address.
  (org-koma-letter-use-foldmarks): Configure presence of foldmarks.
  (org-koma-letter-use-phone): Configure printing of phone number.
  (org-koma-letter-use-email): Configure printing of email.
  (org-koma-letter-use-place): Configure printing of place.
  (koma-letter): Add export option to exporter backend.
  (org-koma-letter-template): Evaluate export options in
  exporter template.

Usage:

  #+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t

Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
---
 contrib/lisp/ox-koma-letter.el | 90 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 77 insertions(+), 13 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 5397cf0..f313ac7 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -80,8 +80,8 @@
   :group 'org-export-koma-letter
   :type 'string)
 
-(defcustom org-koma-letter-closing "Sincerely yours,"
-  "Koma-Letter's closing, as a string."
+(defcustom org-koma-letter-sender nil
+  "Sender's name, as a string."
   :group 'org-export-koma-letter
   :type 'string)
 
@@ -90,13 +90,28 @@
   :group 'org-export-koma-letter
   :type 'string)
 
+(defcustom org-koma-letter-phone-number nil
+  "Sender's phone number, as a string."
+  :group 'org-export-koma-letter
+  :type 'string)
+
+(defcustom org-koma-letter-email nil
+  "Sender's email, as a string."
+  :group 'org-export-koma-letter
+  :type 'string)
+
+(defcustom org-koma-letter-place nil
+  "Place from which the letter is sent."
+  :group 'org-export-koma-letter
+  :type 'string)
+
 (defcustom org-koma-letter-opening "Dear Madam or Sir,"
   "Letter's opening, as a string."
   :group 'org-export-koma-letter
   :type 'string)
 
-(defcustom org-koma-letter-phone-number nil
-  "Sender's phone number, as a string."
+(defcustom org-koma-letter-closing "Sincerely yours,"
+  "Koma-Letter's closing, as a string."
   :group 'org-export-koma-letter
   :type 'string)
 
@@ -105,15 +120,35 @@
   :group 'org-export-koma-letter
   :type 'string)
 
-(defcustom org-koma-letter-sender nil
-  "Sender's name, as a string."
+(defcustom org-koma-letter-use-subject "untitled"
+  "Use the title as the letter's subject."
   :group 'org-export-koma-letter
   :type 'string)
 
-(defcustom org-koma-letter-email nil
-  "Sender's email, as a string."
+(defcustom org-koma-letter-use-backaddress t
+  "Print return address in small line above to address."
   :group 'org-export-koma-letter
-  :type 'string)
+  :type 'boolean)
+
+(defcustom org-koma-letter-use-foldmarks t
+  "Print foldmarks."
+  :group 'org-export-koma-letter
+  :type 'boolean)
+
+(defcustom org-koma-letter-use-phone t
+  "Print sender's phone number."
+  :group 'org-export-koma-letter
+  :type 'boolean)
+
+(defcustom org-koma-letter-use-email t
+  "Print sender's email address."
+  :group 'org-export-koma-letter
+  :type 'boolean)
+
+(defcustom org-koma-letter-use-place t
+  "Print the letter's place next to the date."
+  :group 'org-export-koma-letter
+  :type 'boolean)
 
 \f
 ;;; Define Back-End
@@ -126,9 +161,17 @@
     (:phone-number "PHONE_NUMBER" nil org-koma-letter-phone-number)
     (:email "EMAIL" nil org-koma-letter-email)
     (:to-address "TO_ADDRESS" nil nil newline)
+    (:place "PLACE" nil org-koma-letter-place)
     (:opening "OPENING" nil org-koma-letter-opening)
     (:closing "CLOSING" nil org-koma-letter-closing)
-    (:signature "SIGNATURE" nil org-koma-letter-signature newline))
+    (:signature "SIGNATURE" nil org-koma-letter-signature newline)
+
+    (:with-backaddress nil "backaddress" org-koma-letter-use-backaddress)
+    (:with-foldmarks nil "foldmarks" org-koma-letter-use-foldmarks)
+    (:with-phone nil "phone" org-koma-letter-use-phone)
+    (:with-email nil "email" org-koma-letter-use-email)
+    (:with-place nil "place" org-koma-letter-use-place)
+    (:with-subject nil "subject" org-koma-letter-use-subject))
   :translate-alist '((export-block . org-koma-letter-export-block)
 		     (export-snippet . org-koma-letter-export-snippet)
 		     (keyword . org-koma-letter-keyword)
@@ -226,10 +269,31 @@ holding export options."
       (when signature (format "\\setkomavar{signature}{%s}\n" signature))))
    ;; Date.
    (format "\\date{%s}\n" (org-export-data (org-export-get-date info) info))
-   ;; Letter start.
+   ;; Place
+   (let ((with-place (plist-get info :with-place))
+	 (place (plist-get info :place)))
+     (when (or place (not with-place))
+       (format "\\setkomavar{place}{%s}\n" (if with-place place ""))))
+   ;; KOMA options
+   (let ((with-backaddress (plist-get info :with-backaddress))
+	 (with-foldmarks (plist-get info :with-foldmarks))
+	 (with-phone (plist-get info :with-phone))
+	 (with-email (plist-get info :with-email)))
+     (concat
+      (format "\\KOMAoption{backaddress}{%s}\n" (if with-backaddress "true" "false"))
+      (format "\\KOMAoption{foldmarks}{%s}\n" (if with-foldmarks "true" "false"))
+      (format "\\KOMAoption{fromphone}{%s}\n" (if with-phone "true" "false"))
+      (format "\\KOMAoption{fromemail}{%s}\n" (if with-email "true" "false"))))
+   ;; Document start
    "\\begin{document}\n\n"
-   (format "\\setkomavar{subject}{%s}\n\n"
-           (org-export-data (plist-get info :title) info))
+   ;; Subject
+   (let ((with-subject (plist-get info :with-subject)))
+     (when with-subject
+       (concat
+	(format "\\KOMAoption{subject}{%s}\n" with-subject)
+	(format "\\setkomavar{subject}{%s}\n\n"
+		(org-export-data (plist-get info :title) info)))))
+   ;; Letter start
    (format "\\begin{letter}{%%\n%s}\n\n"
 	   (or (plist-get info :to-address) "no address given"))
    ;; Opening.
-- 
1.8.2


[-- Attachment #5: 0004-ox-koma-letter.el-Support-multiple-LCO-files.patch --]
[-- Type: text/plain, Size: 1396 bytes --]

From c042209c4ebde0aa20571e87d67ef8e6e57c8bfa Mon Sep 17 00:00:00 2001
From: Viktor Rosenfeld <hesk@cartman>
Date: Sun, 21 Apr 2013 18:43:11 +0200
Subject: [PATCH 4/4] ox-koma-letter.el: Support multiple LCO files

  * ox-koma-letter.el (org-koma-letter-template): Treat `#+LCO:'
  variable as a list of multiple LCO files separated by spaces.

Example:

  #+LCO: Default Signed

will result in the following LaTeX fragment

  #+BEGIN_SRC latex
  \LoadLetterOption{Default}
  \LoadLetterOption{Signed}
  #+END_SRC
---
 contrib/lisp/ox-koma-letter.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index f313ac7..31ccd89 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -260,7 +260,12 @@ holding export options."
 	 (signature (plist-get info :signature)))
      (concat
       ;; Letter Class Option File
-      (when lco (format "\\LoadLetterOption{%s}\n" lco))
+      (when lco 
+	(let ((lco-files (split-string lco " "))
+	      (lco-def ""))
+	  (dolist (lco-file lco-files lco-def)
+	    (setq lco-def (format "%s\\LoadLetterOption{%s}\n" lco-def lco-file)))
+	  lco-def))
       ;; Define "From" data.
       (when sender (format "\\setkomavar{fromname}{%s}\n" sender))
       (when from-address (format "\\setkomavar{fromaddress}{%s}\n" from-address))
-- 
1.8.2


[-- Attachment #6: letter.org --]
[-- Type: text/plain, Size: 1170 bytes --]

#+LATEX_CLASS: my-letter
#+LCO: ViktorRosenfeldPrivate Signed
#+TO_ADDRESS: Max Mustermann\\ Musterstraße 1\\ 12345 Musterstadt
#+OPENING: Sehr geehrte Damen und Herren,
#+CLOSING: Mit freundlichen Grüßen
#+LANGUAGE: de-de
#+OPTIONS: phone:t email:t place:t foldmarks:t backaddress:t subject:nil

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enimad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.

#+BEGIN_SRC emacs-lisp :results silent
(setq org-koma-letter-class-option-file nil
      org-koma-letter-opening nil
      org-koma-letter-closing nil
      org-koma-letter-signature nil
      org-koma-letter-use-subject nil
      org-koma-letter-use-backaddress nil
      org-koma-letter-use-foldmarks nil
      org-koma-letter-use-phone nil
      org-koma-letter-use-email nil
      org-koma-letter-use-place nil)
#+END_SRC

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-22 12:09     ` Rasmus
@ 2013-04-22 19:22       ` Viktor Rosenfeld
  2013-04-23 23:46         ` Rasmus
  2013-04-24  0:05         ` Rasmus
  0 siblings, 2 replies; 38+ messages in thread
From: Viktor Rosenfeld @ 2013-04-22 19:22 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Hi Rasmus,

Rasmus wrote:

> >> In a similar spirit to subject is firsthead.  First head is displayed
> >> by default in scrlttr2 as far as I recall, which is annoying.
> >
> > Is firsthead something that you change on a letter-by-letter basis? Or
> > do you configure it once for your letters and never change it? In the
> > latter case the configuration can be moved of to an LCO file. In the
> > former case an option would be nice. I had to actually change the
> > options I introduced so far for different letters (e.g., I don't want
> > foldmarks if I send the letter by email). 
> 
> How I use scrlttr2: I rarely use firsthead as I find ugly.  I use
> firstfoot all of the time and I change it regularly.  E.g. for some
> letters I include bank addresse.  Still, I see your point.

So firsthead would be a boolean export option whereas firstfood would be
a variable to set its content? I can see the use.
 
> >> If we make foldmark an option should it not be a string accepting
> >> values from "Table 4.3.: Combinable values for the configuration of
> >> folding marks with option foldmarks" in the KOMA-Script manual?
> >
> > Same as above. If I read the scrguide correctly, the foldmark variable
> > can be set multiple times, e.g.,
> > #+BEGIN_SRC latex
> > \KOMAoption{foldmarks}{blmtP}
> > \KOMAoption{foldmarks}{true}
> > #+END_SRC
> 
> This is true.
> 
> > The first line sets the behavior (and could be moved to an LCO file),
> > the second line can be used to switch foldmarks on or off (and could be
> > set by the exporter). Haven't tried this though.
> 
> Yeah, I guess it's true.  Still, since foldmarks depends on which
> envelopes you have at hand it might make sense to have it accept a
> string.  In lisp-terms a string is still t.  On the other hand the
> current approach is consistent with your approach above so that's a
> merit.

The more I think about it the more I agree that you should be able to
set any value of foldmarks. The only problem I see is that for other
boolean options one can use `t' whereas for foldmarks one would need to
use `true' (because `t' is a valid configuration value for foldmarks).
But as long as that's documented I see no problem. I will post a patch,
once Alan applies my previous patches.

Cheers,
Viktor

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-22 19:14           ` Viktor Rosenfeld
@ 2013-04-23  6:40             ` Alan Schmitt
  2013-04-23  9:50               ` Viktor Rosenfeld
  2013-04-23  7:28             ` Alan Schmitt
  1 sibling, 1 reply; 38+ messages in thread
From: Alan Schmitt @ 2013-04-23  6:40 UTC (permalink / raw)
  To: Viktor Rosenfeld; +Cc: emacs-orgmode

Hi Viktor,

Viktor Rosenfeld writes:

> Wow, this is great! I didn't know that you can modify the commit history
> so easily. I have attached four patches to this mail which correspond to
> the four points in my earlier email. They have to be applied
> consecutively.

Great, thanks.

> I can't reproduce this. I have attached a minimal letter as an example.
> If I evaluate the emacs-lisp block and export it I can see a graphic
> signature that is defined in `Signed.lco' in my `texmf' directory. What
> happens on your end?

This works (after adding a ":exports results" to the block to avoid its
contents being exported). Something must have been fishy in my old
setup: it wasn't picking up a global setting of
org-koma-letter-signature to nil.

I'm still thinking that the default signature should be nil (so that the
option can be picked up from the LCO), but it's a minor nitpick.

Thanks again for the patch, I'll apply it.

Alan

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-22 19:14           ` Viktor Rosenfeld
  2013-04-23  6:40             ` Alan Schmitt
@ 2013-04-23  7:28             ` Alan Schmitt
  2013-04-23 10:09               ` Viktor Rosenfeld
  1 sibling, 1 reply; 38+ messages in thread
From: Alan Schmitt @ 2013-04-23  7:28 UTC (permalink / raw)
  To: Viktor Rosenfeld; +Cc: emacs-orgmode

Hi again,

I've applied the patch. I propose a further tiny improvement:
,----
| --- a/contrib/lisp/ox-koma-letter.el
| +++ b/contrib/lisp/ox-koma-letter.el
| @@ -273,7 +273,7 @@ holding export options."
|        (when email (format "\\setkomavar{fromemail}{%s}\n" email))
|        (when signature (format "\\setkomavar{signature}{%s}\n" signature))))
|     ;; Date.
| -   (format "\\date{%s}\n" (org-export-data (org-export-get-date info) info))
| +   (format "\\setkomavar{date}{%s}\n" (org-export-data (org-export-get-date info) info))
|     ;; Place
|     (let ((with-place (plist-get info :with-place))
|          (place (plist-get info :place)))
`----

It seems that the date is not picked up by the letter unless it's in a
koma var. I can commit this if you think it's correct.

Thanks,

Alan

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-23  6:40             ` Alan Schmitt
@ 2013-04-23  9:50               ` Viktor Rosenfeld
  2013-04-23  9:54                 ` Alan Schmitt
  0 siblings, 1 reply; 38+ messages in thread
From: Viktor Rosenfeld @ 2013-04-23  9:50 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Hi Alan,

Alan Schmitt wrote:

> I'm still thinking that the default signature should be nil (so that the
> option can be picked up from the LCO), but it's a minor nitpick.

Rasmus also suggested setting the default opening and closing to nil
because we should not assume that everybody speaks English. Maybe, every
variable should default to nil.
 
> Thanks again for the patch, I'll apply it.

Thanks!

Cheers,
Viktor

> 
> Alan
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-23  9:50               ` Viktor Rosenfeld
@ 2013-04-23  9:54                 ` Alan Schmitt
  2013-05-05 13:25                   ` Viktor Rosenfeld
  0 siblings, 1 reply; 38+ messages in thread
From: Alan Schmitt @ 2013-04-23  9:54 UTC (permalink / raw)
  To: Viktor Rosenfeld; +Cc: emacs-orgmode

Viktor Rosenfeld writes:

> Rasmus also suggested setting the default opening and closing to nil
> because we should not assume that everybody speaks English. Maybe, every
> variable should default to nil.

Yes, I think it's a good idea. I often have lines that set the opening
and closing to '~' to avoid having them.

Alan

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-23  7:28             ` Alan Schmitt
@ 2013-04-23 10:09               ` Viktor Rosenfeld
  2013-04-23 11:11                 ` Alan Schmitt
  0 siblings, 1 reply; 38+ messages in thread
From: Viktor Rosenfeld @ 2013-04-23 10:09 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Hi Alan,

Alan Schmitt wrote:

> I've applied the patch. I propose a further tiny improvement:
> ,----
> | --- a/contrib/lisp/ox-koma-letter.el
> | +++ b/contrib/lisp/ox-koma-letter.el
> | @@ -273,7 +273,7 @@ holding export options."
> |        (when email (format "\\setkomavar{fromemail}{%s}\n" email))
> |        (when signature (format "\\setkomavar{signature}{%s}\n" signature))))
> |     ;; Date.
> | -   (format "\\date{%s}\n" (org-export-data (org-export-get-date info) info))
> | +   (format "\\setkomavar{date}{%s}\n" (org-export-data (org-export-get-date info) info))
> |     ;; Place
> |     (let ((with-place (plist-get info :with-place))
> |          (place (plist-get info :place)))
> `----
> 
> It seems that the date is not picked up by the letter unless it's in a
> koma var. I can commit this if you think it's correct.

I can't reproduce your error. The date KOMA variable is automatically
set by the \date LaTeX command which can be verified by the snipplet
below. Out of curiosity, what TeX version are you using? I use TeX Live
2012 which includes scrlttr2 2012/07/29 v3.11b.

In any case, the KOMA-Script guide also uses the KOMA variable in its
examples, so I think your patch is fine.

Cheers,
Viktor

#+BEGIN_SRC latex
\documentclass{scrlttr2}
\usepackage[english,ngerman]{babel}
\LoadLetterOption{DIN}
\date{21. April 2013}
\begin{document}
\begin{letter}{Address}
\opening{Opening}

The date: \usekomavar{date}

\closing{Closing}
\end{letter}
\end{document}
#+END_SRC

> 
> Thanks,
> 
> Alan
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-23 10:09               ` Viktor Rosenfeld
@ 2013-04-23 11:11                 ` Alan Schmitt
  0 siblings, 0 replies; 38+ messages in thread
From: Alan Schmitt @ 2013-04-23 11:11 UTC (permalink / raw)
  To: Viktor Rosenfeld; +Cc: emacs-orgmode

Hi Viktor,

Viktor Rosenfeld writes:

> I can't reproduce your error. The date KOMA variable is automatically
> set by the \date LaTeX command which can be verified by the snipplet
> below. Out of curiosity, what TeX version are you using? I use TeX Live
> 2012 which includes scrlttr2 2012/07/29 v3.11b.
>
> In any case, the KOMA-Script guide also uses the KOMA variable in its
> examples, so I think your patch is fine.

Thanks for checking. The problem was that I was setting the date in my
LCO, and if both \date and \setkomavar{date} are set, then the latter
wins.

So everything is fine, and thanks again!

Alan

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-22 19:22       ` Viktor Rosenfeld
@ 2013-04-23 23:46         ` Rasmus
  2013-05-05 13:27           ` Viktor Rosenfeld
  2013-04-24  0:05         ` Rasmus
  1 sibling, 1 reply; 38+ messages in thread
From: Rasmus @ 2013-04-23 23:46 UTC (permalink / raw)
  To: listuser36; +Cc: emacs-orgmode

Viktor Rosenfeld <listuser36@gmail.com> writes:

>> Yeah, I guess it's true.  Still, since foldmarks depends on which
>> envelopes you have at hand it might make sense to have it accept a
>> string.  In lisp-terms a string is still t.  On the other hand the
>> current approach is consistent with your approach above so that's a
>> merit.
>
> The more I think about it the more I agree that you should be able to
> set any value of foldmarks. The only problem I see is that for other
> boolean options one can use `t' whereas for foldmarks one would need to
> use `true' (because `t' is a valid configuration value for foldmarks).
> But as long as that's documented I see no problem. I will post a patch,
> once Alan applies my previous patches.

I don't know the details of the exporter well enough on this detail,
but perhaps it can be utilized that t ≠ "t"; if that's true in the
exporter as well.  In normal lisp (characterp "t") => t and
(characterp t) nil.  But I'm not sure if t would be transformed before
being able to check. . . 

Thanks,
Rasmus

-- 
May the Force be with you

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-22 19:22       ` Viktor Rosenfeld
  2013-04-23 23:46         ` Rasmus
@ 2013-04-24  0:05         ` Rasmus
  2013-05-05 13:30           ` Viktor Rosenfeld
  1 sibling, 1 reply; 38+ messages in thread
From: Rasmus @ 2013-04-24  0:05 UTC (permalink / raw)
  To: listuser36, emacs-orgmode


Viktor,

>> >> In a similar spirit to subject is firsthead.  First head is displayed
>> >> by default in scrlttr2 as far as I recall, which is annoying.
>> >
>> > Is firsthead something that you change on a letter-by-letter basis? Or
>> > do you configure it once for your letters and never change it? In the
>> > latter case the configuration can be moved of to an LCO file. In the
>> > former case an option would be nice. I had to actually change the
>> > options I introduced so far for different letters (e.g., I don't want
>> > foldmarks if I send the letter by email). 
>> 
>> How I use scrlttr2: I rarely use firsthead as I find ugly.  I use
>> firstfoot all of the time and I change it regularly.  E.g. for some
>> letters I include bank addresse.  Still, I see your point.
>
> So firsthead would be a boolean export option whereas firstfood would be
> a variable to set its content? I can see the use.

Both take whatever LaTeX you'll throw at them (within reasons) so
neither is boolean.  I use a table with varying information for my
firstfoot and nothing for my first head, but if you had a business
letter you'd maybe have a logo up there or what not.  But again, the
question is whether it should be a LCO file or Org.

One thing I'd like to do when time permits is to make a firstfood
argument that takes a table name as an input, simply because tables
are much nicer to work with in Org.  But again  it might be an
overkill. . .

–Rasmus

-- 
. . . It begins of course with The Internet.  A Net of Peers.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-23  9:54                 ` Alan Schmitt
@ 2013-05-05 13:25                   ` Viktor Rosenfeld
  2013-05-05 16:24                     ` Alan Schmitt
  0 siblings, 1 reply; 38+ messages in thread
From: Viktor Rosenfeld @ 2013-05-05 13:25 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 472 bytes --]

Hi Alan,

I've removed the defaults from OPENING and CLOSING. See the attached
patch.

Cheers,
Viktor

Alan Schmitt wrote:

> Viktor Rosenfeld writes:
> 
> > Rasmus also suggested setting the default opening and closing to nil
> > because we should not assume that everybody speaks English. Maybe, every
> > variable should default to nil.
> 
> Yes, I think it's a good idea. I often have lines that set the opening
> and closing to '~' to avoid having them.
> 
> Alan
> 

[-- Attachment #2: 0001-ox-koma-letter.el-No-default-opening-and-closing-lin.patch --]
[-- Type: text/plain, Size: 1286 bytes --]

From 1455bc78d87649ff2b41760f382c20fae4ecd585 Mon Sep 17 00:00:00 2001
From: Viktor Rosenfeld <listuser36@gmail.com>
Date: Sun, 5 May 2013 15:11:15 +0200
Subject: [PATCH 1/2] ox-koma-letter.el: No default opening and closing line.

	* ox-koma-letter.el (org-koma-letter-opening): No default / set to nil.
	(org-koma-letter-closing): No default / set to nil.

	We should not assume a formal English opening and closing
	line.  A letter requires many personal options, such as the
	address, so it is no more work to also these options.

TINYCHANGE
---
 contrib/lisp/ox-koma-letter.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 31ccd89..37ff903 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -105,12 +105,12 @@
   :group 'org-export-koma-letter
   :type 'string)
 
-(defcustom org-koma-letter-opening "Dear Madam or Sir,"
+(defcustom org-koma-letter-opening nil
   "Letter's opening, as a string."
   :group 'org-export-koma-letter
   :type 'string)
 
-(defcustom org-koma-letter-closing "Sincerely yours,"
+(defcustom org-koma-letter-closing nil
   "Koma-Letter's closing, as a string."
   :group 'org-export-koma-letter
   :type 'string)
-- 
1.8.2.2


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-23 23:46         ` Rasmus
@ 2013-05-05 13:27           ` Viktor Rosenfeld
  2013-05-05 16:33             ` Alan Schmitt
  0 siblings, 1 reply; 38+ messages in thread
From: Viktor Rosenfeld @ 2013-05-05 13:27 UTC (permalink / raw)
  To: Rasmus; +Cc: alan.schmitt, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1486 bytes --]

Hi Rasmus and Alan,

I've changed the code so the value for foldmarks is passed through to
KOMA-Script. It's a bit ugly insofar as one has to specify
foldmarks:true to use the default values instead of other options, such
as backaddress:t. However, subject also uses a string already.

See the attached patch.

Cheers,
Viktor

Rasmus wrote:

> Viktor Rosenfeld <listuser36@gmail.com> writes:
> 
> >> Yeah, I guess it's true.  Still, since foldmarks depends on which
> >> envelopes you have at hand it might make sense to have it accept a
> >> string.  In lisp-terms a string is still t.  On the other hand the
> >> current approach is consistent with your approach above so that's a
> >> merit.
> >
> > The more I think about it the more I agree that you should be able to
> > set any value of foldmarks. The only problem I see is that for other
> > boolean options one can use `t' whereas for foldmarks one would need to
> > use `true' (because `t' is a valid configuration value for foldmarks).
> > But as long as that's documented I see no problem. I will post a patch,
> > once Alan applies my previous patches.
> 
> I don't know the details of the exporter well enough on this detail,
> but perhaps it can be utilized that t ≠ "t"; if that's true in the
> exporter as well.  In normal lisp (characterp "t") => t and
> (characterp t) nil.  But I'm not sure if t would be transformed before
> being able to check. . . 
> 
> Thanks,
> Rasmus
> 
> -- 
> May the Force be with you
> 

[-- Attachment #2: 0002-ox-koma-letter.el-Give-the-user-complete-control-ove.patch --]
[-- Type: text/plain, Size: 1804 bytes --]

From b506dd781404a999056a0348fb7f3eb8c8ef4524 Mon Sep 17 00:00:00 2001
From: Viktor Rosenfeld <listuser36@gmail.com>
Date: Sun, 5 May 2013 15:22:51 +0200
Subject: [PATCH 2/2] ox-koma-letter.el: Give the user complete control over
 foldmarks appearance.

	* ox-koma-letter.el (org-koma-letter-use-foldmarks) Update
	documentation
	(org-koma-letter-template): Pass foldmarks setting to
	KOMA-Script

TINYCHANGE
---
 contrib/lisp/ox-koma-letter.el | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 37ff903..96c0569 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -130,10 +130,15 @@
   :group 'org-export-koma-letter
   :type 'boolean)
 
-(defcustom org-koma-letter-use-foldmarks t
-  "Print foldmarks."
+(defcustom org-koma-letter-use-foldmarks "true"
+  "Configure appearence of fold marks.
+
+Accepts any valid value for the KOMA-Script `foldmarks' option.
+
+Use `foldmarks:true' to activate default fold marks or
+`foldmarks:nil' to deactivate fold marks."
   :group 'org-export-koma-letter
-  :type 'boolean)
+  :type 'string)
 
 (defcustom org-koma-letter-use-phone t
   "Print sender's phone number."
@@ -286,7 +291,7 @@ holding export options."
 	 (with-email (plist-get info :with-email)))
      (concat
       (format "\\KOMAoption{backaddress}{%s}\n" (if with-backaddress "true" "false"))
-      (format "\\KOMAoption{foldmarks}{%s}\n" (if with-foldmarks "true" "false"))
+      (format "\\KOMAoption{foldmarks}{%s}\n" (if with-foldmarks with-foldmarks "false"))
       (format "\\KOMAoption{fromphone}{%s}\n" (if with-phone "true" "false"))
       (format "\\KOMAoption{fromemail}{%s}\n" (if with-email "true" "false"))))
    ;; Document start
-- 
1.8.2.2


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-24  0:05         ` Rasmus
@ 2013-05-05 13:30           ` Viktor Rosenfeld
  0 siblings, 0 replies; 38+ messages in thread
From: Viktor Rosenfeld @ 2013-05-05 13:30 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Hi Rasmus,

Rasmus wrote:

> Viktor,
> 
> >> >> In a similar spirit to subject is firsthead.  First head is displayed
> >> >> by default in scrlttr2 as far as I recall, which is annoying.
> >> >
> >> > Is firsthead something that you change on a letter-by-letter basis? Or
> >> > do you configure it once for your letters and never change it? In the
> >> > latter case the configuration can be moved of to an LCO file. In the
> >> > former case an option would be nice. I had to actually change the
> >> > options I introduced so far for different letters (e.g., I don't want
> >> > foldmarks if I send the letter by email). 
> >> 
> >> How I use scrlttr2: I rarely use firsthead as I find ugly.  I use
> >> firstfoot all of the time and I change it regularly.  E.g. for some
> >> letters I include bank addresse.  Still, I see your point.
> >
> > So firsthead would be a boolean export option whereas firstfood would be
> > a variable to set its content? I can see the use.
> 
> Both take whatever LaTeX you'll throw at them (within reasons) so
> neither is boolean.  I use a table with varying information for my
> firstfoot and nothing for my first head, but if you had a business
> letter you'd maybe have a logo up there or what not.  But again, the
> question is whether it should be a LCO file or Org.
> 
> One thing I'd like to do when time permits is to make a firstfood
> argument that takes a table name as an input, simply because tables
> are much nicer to work with in Org.  But again  it might be an
> overkill. . .

I've thought about it and do not think it is a good idea to introduce
specific options for firstfoot and so on. Since firstfoot can take
arbitrary TeX-Code, setting it in the Org file can quickly become
cumbersome. And a footer containing banking information is fairly
consistent, so it can be set in an optional LCO file. I've used this as
an example in the tutorial on Worg. (I pushed the tutorial today, but
it's not published yet.)

Cheers,
Viktor

> 
> –Rasmus
> 
> -- 
> . . . It begins of course with The Internet.  A Net of Peers.
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-04-22  8:24 ` Alan Schmitt
  2013-04-22  8:47   ` Nicolas Goaziou
  2013-04-22 10:49   ` Viktor Rosenfeld
@ 2013-05-05 13:35   ` Viktor Rosenfeld
  2013-05-05 17:07     ` Alan Schmitt
  2013-05-14 22:29     ` Suvayu Ali
  2 siblings, 2 replies; 38+ messages in thread
From: Viktor Rosenfeld @ 2013-05-05 13:35 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Hi Alan,

I've pushed a draft tutorial to Worg, but it's not published yet. Do you
know if there is a delay or if I have to do anything else? I saw the
publishing process output after my push which ended with the following:

   remote: Publishing file /home/emacs/git/worg/sitemap.org using
   `org-publish-org-to-html'
   remote: Symbol's function definition is void: org-publish-org-to-html
   remote: worg publish process 7241 exited at 05/05/13@07:53:51
   To worg@orgmode.org:worg.git
      a3eed5c..9531016  master -> master

I assume this is an error?

In any case, you can find the tutorial at
./org-tutorials/koma-letter-export.org

Cheers,
Viktor

Alan Schmitt wrote:

> Hi,
> 
> Viktor Rosenfeld writes:
> 
> > Hi,
> >
> > I've hacked the ox-koma-letter exporter to make it more configurable.
> > See the Changelog of the attached patch, hopefully I've followed the
> > Changelog guidelines propertly.
> 
> This looks very nice, thanks a lot.
> 
> I'm not sure about the procedure to apply this patch, however. Should I
> do it myself?
> 
> > Also, I could not find an ox-koma-letter tutorial on Worg. I would be
> > willing to create such a tutorial, maybe next weekend. Can anybody edit
> > the contents on Worg or do I need special priviledges?
> 
> You need to ask for write access.
> 
> I started writing a tutorial, but I was caught up in too many things and
> could not finish it. If you want I can send you privately what I have
> written (or I can push it to worg and we can edit it together).
> 
> Best,
> 
> Alan
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-05-05 13:25                   ` Viktor Rosenfeld
@ 2013-05-05 16:24                     ` Alan Schmitt
  0 siblings, 0 replies; 38+ messages in thread
From: Alan Schmitt @ 2013-05-05 16:24 UTC (permalink / raw)
  To: Viktor Rosenfeld; +Cc: emacs-orgmode

Viktor Rosenfeld writes:

> Hi Alan,
>
> I've removed the defaults from OPENING and CLOSING. See the attached
> patch.

Thanks, I've applied it.

To magit/emacs users: is there a way to apply a patch (with signoff)
directly from emacs (I guess with magit)? I typically go to a shell to
do so ...

Alan

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-05-05 13:27           ` Viktor Rosenfeld
@ 2013-05-05 16:33             ` Alan Schmitt
  2013-05-05 16:44               ` Viktor Rosenfeld
  0 siblings, 1 reply; 38+ messages in thread
From: Alan Schmitt @ 2013-05-05 16:33 UTC (permalink / raw)
  To: Viktor Rosenfeld; +Cc: emacs-orgmode, Rasmus

Hi Victor,

Viktor Rosenfeld writes:

> Hi Rasmus and Alan,
>
> I've changed the code so the value for foldmarks is passed through to
> KOMA-Script. It's a bit ugly insofar as one has to specify
> foldmarks:true to use the default values instead of other options, such
> as backaddress:t. However, subject also uses a string already.

I have a question about this: is there some special magic that makes the
string "nil" to be parsed as `nil' and not as the string?

About the subject, I had a quick look at the code and I find it
surprising: the default is "untitled", and I don't know how one can set
it to nil (unless there is some magic in plist-get that transforms the
"nil" string into nil).

Please don't hesitate to educate me, I'm very much an emacs-lisp newbie.

Best,

Alan

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-05-05 16:33             ` Alan Schmitt
@ 2013-05-05 16:44               ` Viktor Rosenfeld
  2013-05-05 17:06                 ` Alan Schmitt
  0 siblings, 1 reply; 38+ messages in thread
From: Viktor Rosenfeld @ 2013-05-05 16:44 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode, Rasmus

Hi Alan,

Alan Schmitt wrote:

> Hi Victor,
> 
> Viktor Rosenfeld writes:
> 
> > Hi Rasmus and Alan,
> >
> > I've changed the code so the value for foldmarks is passed through to
> > KOMA-Script. It's a bit ugly insofar as one has to specify
> > foldmarks:true to use the default values instead of other options, such
> > as backaddress:t. However, subject also uses a string already.
> 
> I have a question about this: is there some special magic that makes the
> string "nil" to be parsed as `nil' and not as the string?

I assume there must be. If I specify `foldmarks:nil' the if-statement in
line 294 evaluates it as false:

#+BEGIN_SRC emacs-lisp
(format "\\KOMAoption{foldmarks}{%s}\n" (if with-foldmarks with-foldmarks "false"))
#+END_SRC

> About the subject, I had a quick look at the code and I find it
> surprising: the default is "untitled", and I don't know how one can set
> it to nil (unless there is some magic in plist-get that transforms the
> "nil" string into nil).

Same as above. `subject:nil' causes the code to skip the when-statement in line
301.

#+BEGIN_SRC emacs-lisp
(let ((with-subject (plist-get info :with-subject)))
  (when with-subject
    (concat
     (format "\\KOMAoption{subject}{%s}\n" with-subject)
     (format "\\setkomavar{subject}{%s}\n\n"
             (org-export-data (plist-get info :title) info)))))
#+END_SRC

Note, that untitled prints the subject but without a prefix. Setting it to nil
hides the subject altogether.

> Please don't hesitate to educate me, I'm very much an emacs-lisp newbie.

Me too.

Cheers,
Viktor

> 
> Best,
> 
> Alan
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-05-05 16:44               ` Viktor Rosenfeld
@ 2013-05-05 17:06                 ` Alan Schmitt
  0 siblings, 0 replies; 38+ messages in thread
From: Alan Schmitt @ 2013-05-05 17:06 UTC (permalink / raw)
  To: Viktor Rosenfeld; +Cc: emacs-orgmode, Rasmus

Viktor Rosenfeld writes:

>> I have a question about this: is there some special magic that makes the
>> string "nil" to be parsed as `nil' and not as the string?
>
> I assume there must be. If I specify `foldmarks:nil' the if-statement in
> line 294 evaluates it as false:
>
> #+BEGIN_SRC emacs-lisp
> (format "\\KOMAoption{foldmarks}{%s}\n" (if with-foldmarks with-foldmarks "false"))
> #+END_SRC

OK.

>> About the subject, I had a quick look at the code and I find it
>> surprising: the default is "untitled", and I don't know how one can set
>> it to nil (unless there is some magic in plist-get that transforms the
>> "nil" string into nil).
>
> Same as above. `subject:nil' causes the code to skip the when-statement in line
> 301.
>
> #+BEGIN_SRC emacs-lisp
> (let ((with-subject (plist-get info :with-subject)))
>   (when with-subject
>     (concat
>      (format "\\KOMAoption{subject}{%s}\n" with-subject)
>      (format "\\setkomavar{subject}{%s}\n\n"
>              (org-export-data (plist-get info :title) info)))))
> #+END_SRC
>
> Note, that untitled prints the subject but without a prefix. Setting it to nil
> hides the subject altogether.

Thanks for the clarification.

I've applied the patch.

Best,

Alan

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-05-05 13:35   ` Viktor Rosenfeld
@ 2013-05-05 17:07     ` Alan Schmitt
  2013-05-14 16:09       ` Viktor Rosenfeld
  2013-05-14 22:29     ` Suvayu Ali
  1 sibling, 1 reply; 38+ messages in thread
From: Alan Schmitt @ 2013-05-05 17:07 UTC (permalink / raw)
  To: Viktor Rosenfeld; +Cc: emacs-orgmode

Viktor Rosenfeld writes:

> Hi Alan,
>
> I've pushed a draft tutorial to Worg, but it's not published yet. Do you
> know if there is a delay or if I have to do anything else? I saw the
> publishing process output after my push which ended with the following:
>
>    remote: Publishing file /home/emacs/git/worg/sitemap.org using
>    `org-publish-org-to-html'
>    remote: Symbol's function definition is void: org-publish-org-to-html
>    remote: worg publish process 7241 exited at 05/05/13@07:53:51
>    To worg@orgmode.org:worg.git
>       a3eed5c..9531016  master -> master
>
> I assume this is an error?

I guess, I've never published on worg before.

> In any case, you can find the tutorial at
> ./org-tutorials/koma-letter-export.org

Thanks, I'll have a look.

Alan

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-05-05 17:07     ` Alan Schmitt
@ 2013-05-14 16:09       ` Viktor Rosenfeld
  2013-05-14 21:20         ` Rasmus
                           ` (2 more replies)
  0 siblings, 3 replies; 38+ messages in thread
From: Viktor Rosenfeld @ 2013-05-14 16:09 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Hi Alan,

I just wanted to let you know that the tutorial is now online. I haven't
linked to it from the org-tutorials page yet, in case you want to take a
look. You can find it at
http://orgmode.org/worg/org-tutorials/koma-letter-export.html

Cheers,
Viktor

Alan Schmitt wrote:

> Viktor Rosenfeld writes:
> 
> > Hi Alan,
> >
> > I've pushed a draft tutorial to Worg, but it's not published yet. Do you
> > know if there is a delay or if I have to do anything else? I saw the
> > publishing process output after my push which ended with the following:
> >
> >    remote: Publishing file /home/emacs/git/worg/sitemap.org using
> >    `org-publish-org-to-html'
> >    remote: Symbol's function definition is void: org-publish-org-to-html
> >    remote: worg publish process 7241 exited at 05/05/13@07:53:51
> >    To worg@orgmode.org:worg.git
> >       a3eed5c..9531016  master -> master
> >
> > I assume this is an error?
> 
> I guess, I've never published on worg before.
> 
> > In any case, you can find the tutorial at
> > ./org-tutorials/koma-letter-export.org
> 
> Thanks, I'll have a look.
> 
> Alan
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-05-14 16:09       ` Viktor Rosenfeld
@ 2013-05-14 21:20         ` Rasmus
  2013-05-16 18:35           ` Viktor Rosenfeld
  2013-05-14 23:56         ` Thomas S. Dye
  2013-05-15  6:38         ` Alan Schmitt
  2 siblings, 1 reply; 38+ messages in thread
From: Rasmus @ 2013-05-14 21:20 UTC (permalink / raw)
  To: emacs-orgmode

Viktor Rosenfeld <listuser36@gmail.com> writes:

> Hi Alan,
>
> I just wanted to let you know that the tutorial is now online. I
> haven't
> linked to it from the org-tutorials page yet, in case you want to take
> a
> look. You can find it at
> http://orgmode.org/worg/org-tutorials/koma-letter-export.html

First: thanks for writing this!

Second: comments.  They are just quick notes and you can ignore all of
it, if so desired.

I don't know what the most efficient way to share comments is.  For
now I've just separated comments by double space and intended quotes.


   "Optionally download an up-to-date KOMA letter exporter"
Is this something we want to encourage people to do?


I think that 

   "1. Add the path containing ox-koma-letter.el to Emacs' load path...."

is so common that it need not be included.  If anything it should link
to another wiki page explaining how to add stuff to the load path as
to not add a step that (what I'd guess) a high percentage of the
readers would know.  


  "download the KOMA letter example and you can also download the
   example PDF letter."

Links aren't working here.


   "Configuration guide"
Very nice.


   "Letter meta data can be configured in one of three ways, listed
   below from the most specific to the most general:"

4. through org-latex-classes (e.g. defining my-business-letter and
   my-love-letter).  But perhaps this is considered bad practice?


   "Setting letter meta data in Emacs variables"
This stuff is covered in the subsection just above.  But that's
probably OK.


   "Custom LCO files must be placed in a directory where LaTeX will
   find them. On Linux, this defaults to ~/texmf/tex/latex. On OS X,
   use ~/Library/texmf/tex/latex instead. These paths can be
   configured using the following command:"

Mayhaps one could add:

   In TeXLive you can test whether foo.lco is recognized by TeXLive by
   typing =kpsewhich foo.lco=.  After adding a file to the TeXLive
   path you may have to run =mktexlsr=.

 
   List of KOMA letter meta data, [...], List of KOMA letter options
Nice tables!  

–Rasmus

-- 
This is the kind of tedious nonsense up with which I will not put

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-05-05 13:35   ` Viktor Rosenfeld
  2013-05-05 17:07     ` Alan Schmitt
@ 2013-05-14 22:29     ` Suvayu Ali
  2013-05-16 18:35       ` Viktor Rosenfeld
  1 sibling, 1 reply; 38+ messages in thread
From: Suvayu Ali @ 2013-05-14 22:29 UTC (permalink / raw)
  To: emacs-orgmode

Hi Viktor,

I'm chiming in very late here.

On Sun, May 05, 2013 at 03:35:51PM +0200, Viktor Rosenfeld wrote:
> 
> In any case, you can find the tutorial at
> ./org-tutorials/koma-letter-export.org

The convention is to put all documentation about the new exporters under
Worg.git/exporters.  Take a look here:

  <http://orgmode.org/worg/exporters/>

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-05-14 16:09       ` Viktor Rosenfeld
  2013-05-14 21:20         ` Rasmus
@ 2013-05-14 23:56         ` Thomas S. Dye
  2013-05-16 18:35           ` Viktor Rosenfeld
  2013-05-15  6:38         ` Alan Schmitt
  2 siblings, 1 reply; 38+ messages in thread
From: Thomas S. Dye @ 2013-05-14 23:56 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Aloha Viktor,

Nice work! I've been trying to find time to experiment with
ox-koma-letter.  Your tutorial will help.

One small nit to pick, according to my dictionary "meta data" ->
"metadata".

All the best,
Tom

Viktor Rosenfeld <listuser36@gmail.com> writes:

> Hi Alan,
>
> I just wanted to let you know that the tutorial is now online. I haven't
> linked to it from the org-tutorials page yet, in case you want to take a
> look. You can find it at
> http://orgmode.org/worg/org-tutorials/koma-letter-export.html
>
> Cheers,
> Viktor
>
> Alan Schmitt wrote:
>
>> Viktor Rosenfeld writes:
>> 
>> > Hi Alan,
>> >
>> > I've pushed a draft tutorial to Worg, but it's not published yet. Do you
>> > know if there is a delay or if I have to do anything else? I saw the
>> > publishing process output after my push which ended with the following:
>> >
>> >    remote: Publishing file /home/emacs/git/worg/sitemap.org using
>> >    `org-publish-org-to-html'
>> >    remote: Symbol's function definition is void: org-publish-org-to-html
>> >    remote: worg publish process 7241 exited at 05/05/13@07:53:51
>> >    To worg@orgmode.org:worg.git
>> >       a3eed5c..9531016  master -> master
>> >
>> > I assume this is an error?
>> 
>> I guess, I've never published on worg before.
>> 
>> > In any case, you can find the tutorial at
>> > ./org-tutorials/koma-letter-export.org
>> 
>> Thanks, I'll have a look.
>> 
>> Alan
>> 
>
>

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-05-14 16:09       ` Viktor Rosenfeld
  2013-05-14 21:20         ` Rasmus
  2013-05-14 23:56         ` Thomas S. Dye
@ 2013-05-15  6:38         ` Alan Schmitt
  2 siblings, 0 replies; 38+ messages in thread
From: Alan Schmitt @ 2013-05-15  6:38 UTC (permalink / raw)
  To: Viktor Rosenfeld; +Cc: emacs-orgmode

Hi Viktor,

Viktor Rosenfeld writes:

> Hi Alan,
>
> I just wanted to let you know that the tutorial is now online. I haven't
> linked to it from the org-tutorials page yet, in case you want to take a
> look. You can find it at
> http://orgmode.org/worg/org-tutorials/koma-letter-export.html

This is great, thanks a lot for you hard work.

Alan

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-05-14 22:29     ` Suvayu Ali
@ 2013-05-16 18:35       ` Viktor Rosenfeld
  0 siblings, 0 replies; 38+ messages in thread
From: Viktor Rosenfeld @ 2013-05-16 18:35 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: emacs-orgmode

Hi Suvayu,

Suvayu Ali wrote:

> The convention is to put all documentation about the new exporters under
> Worg.git/exporters.  Take a look here:
> 
>   <http://orgmode.org/worg/exporters/>

Thanks. I've also added an entry to the index file.

Cheers,
Viktor

> 
> Hope this helps,
> 
> -- 
> Suvayu
> 
> Open source is the future. It sets us free.
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-05-14 23:56         ` Thomas S. Dye
@ 2013-05-16 18:35           ` Viktor Rosenfeld
  0 siblings, 0 replies; 38+ messages in thread
From: Viktor Rosenfeld @ 2013-05-16 18:35 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Alan Schmitt, emacs-orgmode

Hi Tom,

Thomas S. Dye wrote:

> One small nit to pick, according to my dictionary "meta data" ->
> "metadata".

Thanks, I've changed this.

Cheers,
Viktor

> 
> All the best,
> Tom

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] Improve configurability of ox-koma-letter
  2013-05-14 21:20         ` Rasmus
@ 2013-05-16 18:35           ` Viktor Rosenfeld
  0 siblings, 0 replies; 38+ messages in thread
From: Viktor Rosenfeld @ 2013-05-16 18:35 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Hi Rasmus,

Rasmus wrote:

>    "Optionally download an up-to-date KOMA letter exporter"
> Is this something we want to encourage people to do?

We probably shouldn't. The problem is that the tutorial depends on
a version that has not yet been released. Once Org-mode 8.1 arrives the
best thing to do is to only refer to released functionality. Until then,
I've changed the text somewhat and put a bold *Note* in front of it.
 
> I think that 
> 
>    "1. Add the path containing ox-koma-letter.el to Emacs' load path...."
> 
> is so common that it need not be included.  If anything it should link
> to another wiki page explaining how to add stuff to the load path as
> to not add a step that (what I'd guess) a high percentage of the
> readers would know.  

I'd rather have the minimal guide to be complete so newbies do not have
to go hunting for information.

>   "download the KOMA letter example and you can also download the
>    example PDF letter."
> 
> Links aren't working here.

Somehow the source of the Org file isn't served by the webserver and
neither is the PDF I've checked in. Not really sure what the problem is,
maybe it has something to do with the change in the exporter.

>    "Letter meta data can be configured in one of three ways, listed
>    below from the most specific to the most general:"
> 
> 4. through org-latex-classes (e.g. defining my-business-letter and
>    my-love-letter).  But perhaps this is considered bad practice?

I haven't thought about this at all. It's somewhat orthogonal to the
other configuration options. I've trimmed the latex class definition
down because configuration options which are set there are fairly fixed.
But it's a valid approach. I've added some text to this effect.

>    "Custom LCO files must be placed in a directory where LaTeX will
>    find them. On Linux, this defaults to ~/texmf/tex/latex. On OS X,
>    use ~/Library/texmf/tex/latex instead. These paths can be
>    configured using the following command:"
> 
> Mayhaps one could add:
> 
>    In TeXLive you can test whether foo.lco is recognized by TeXLive by
>    typing =kpsewhich foo.lco=.  After adding a file to the TeXLive
>    path you may have to run =mktexlsr=.

Thanks, I've added that.

Cheers,
Viktor

> 
> –Rasmus
> 
> -- 
> This is the kind of tedious nonsense up with which I will not put
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2013-05-16 18:35 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-21 17:59 [PATCH] Improve configurability of ox-koma-letter Viktor Rosenfeld
2013-04-22  8:24 ` Alan Schmitt
2013-04-22  8:47   ` Nicolas Goaziou
2013-04-22  9:31     ` Alan Schmitt
2013-04-22 10:57       ` Viktor Rosenfeld
2013-04-22 12:06         ` Alan Schmitt
2013-04-22 19:14           ` Viktor Rosenfeld
2013-04-23  6:40             ` Alan Schmitt
2013-04-23  9:50               ` Viktor Rosenfeld
2013-04-23  9:54                 ` Alan Schmitt
2013-05-05 13:25                   ` Viktor Rosenfeld
2013-05-05 16:24                     ` Alan Schmitt
2013-04-23  7:28             ` Alan Schmitt
2013-04-23 10:09               ` Viktor Rosenfeld
2013-04-23 11:11                 ` Alan Schmitt
2013-04-22 10:49   ` Viktor Rosenfeld
2013-05-05 13:35   ` Viktor Rosenfeld
2013-05-05 17:07     ` Alan Schmitt
2013-05-14 16:09       ` Viktor Rosenfeld
2013-05-14 21:20         ` Rasmus
2013-05-16 18:35           ` Viktor Rosenfeld
2013-05-14 23:56         ` Thomas S. Dye
2013-05-16 18:35           ` Viktor Rosenfeld
2013-05-15  6:38         ` Alan Schmitt
2013-05-14 22:29     ` Suvayu Ali
2013-05-16 18:35       ` Viktor Rosenfeld
2013-04-22  9:57 ` Rasmus
2013-04-22 11:27   ` Viktor Rosenfeld
2013-04-22 12:09     ` Rasmus
2013-04-22 19:22       ` Viktor Rosenfeld
2013-04-23 23:46         ` Rasmus
2013-05-05 13:27           ` Viktor Rosenfeld
2013-05-05 16:33             ` Alan Schmitt
2013-05-05 16:44               ` Viktor Rosenfeld
2013-05-05 17:06                 ` Alan Schmitt
2013-04-24  0:05         ` Rasmus
2013-05-05 13:30           ` Viktor Rosenfeld
2013-04-22 17:13   ` Bastien

Code repositories for project(s) associated with this 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).