Re: [O] [patch][ox-koma-letter] Support for to and from headings

2013-06-12 Thread Alan Schmitt
Hi Rasmus,

Rasmus writes:

 Rasmus ras...@gmx.us writes:

 Rasmus ras...@gmx.us writes:

 Hi,

 Some more patches that should work against the master branch.

 Patch 1: bug fixes.  Most notably use symbols some places rather than
 strings.

 Patch 2 adds support for TO and FROM headings.  If you've got time for
 testing I would appreciate feedback.  It's explained in the top of the
 patch.

 Patch 1 and 2 are updated.  Patch three adds support for an
 `org-koma-letter-default-class' and a plug-in function to make it
 easier to use letters.  They should apply against master.

 Updated again and hopefully better changelog etc. . .

I applied the patches (just changing a small typo in the changelog).

Alan



Re: [O] [patch][ox-koma-letter] Support for to and from headings

2013-06-12 Thread Rasmus
Alan Schmitt alan.schm...@polytechnique.org writes:

 I applied the patches (just changing a small typo in the changelog).

Thanks, let me know if any errors pop up.

–Rasmus

-- 
When in doubt, do it!



Re: [O] [patch][ox-koma-letter] Support for to and from headings

2013-06-11 Thread Rasmus
Rasmus ras...@gmx.us writes:

 Rasmus ras...@gmx.us writes:

 Hi,

 Some more patches that should work against the master branch.

 Patch 1: bug fixes.  Most notably use symbols some places rather than
 strings.

 Patch 2 adds support for TO and FROM headings.  If you've got time for
 testing I would appreciate feedback.  It's explained in the top of the
 patch.

 Patch 1 and 2 are updated.  Patch three adds support for an
 `org-koma-letter-default-class' and a plug-in function to make it
 easier to use letters.  They should apply against master.

Updated again and hopefully better changelog etc. . .

–Rasmus

--
This is the kind of tedious nonsense up with which I will not put
From b3d3d781a32990e3b7e5ca5f2812a106a458814c Mon Sep 17 00:00:00 2001
From: rasmus.pank rasmus.p...@gmail.com
Date: Mon, 27 May 2013 17:29:14 +0200
Subject: [PATCH 1/4] Bug fixes for ox-koma-letter.el

* ox-koma-letter.el: updated documentation and improved defcustoms.
(org-koma-letter-special-tags-after-letter)
(org-koma-letter-special-tags-after-closing): now symbol.
(org-koma-letter--get-custom): falls back to value
(org-koma-letter--prepare-special-contents-as-macro): let
newlines be handled outside of the function
(org-koma-letter--remove-offending-new-lines): function to add
new lines.
(org-koma-letter-headline): updated to work with symbols and
made more robust.
(org-koma-letter-export-to-latex): reset
=`org-koma-letter-special-contents'= to nil
---
 contrib/lisp/ox-koma-letter.el | 118 -
 1 file changed, 81 insertions(+), 37 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 4af0ba7..8f24d83 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -33,12 +33,43 @@
 ;;
 ;; On top of buffer keywords supported by `latex' back-end (see
 ;; `org-latex-options-alist'), this back-end introduces the following
-;; keywords: CLOSING (see `org-koma-letter-closing'), FROM_ADDRESS
-;; (see `org-koma-letter-from-address'), LCO (see
-;; `org-koma-letter-class-option-file'), OPENING (see
-;; `org-koma-letter-opening'), PHONE_NUMBER (see
-;; `org-koma-letter-phone-number'), SIGNATURE (see
-;; `org-koma-letter-signature') and TO_ADDRESS.
+;; keywords:
+;;   - CLOSING (see `org-koma-letter-closing'),
+;;   - FROM_ADDRESS (see `org-koma-letter-from-address'),
+;;   - LCO (see `org-koma-letter-class-option-file'),
+;;   - OPENING (see `org-koma-letter-opening'),
+;;   - PHONE_NUMBER (see `org-koma-letter-phone-number'),
+;;   - SIGNATURE (see `org-koma-letter-signature')
+;;   - PLACE (see `org-koma-letter-place')
+;;   - and TO_ADDRESS.
+;;
+;; A number of OPTIONS settings can be set to change which contents is
+;; exported.
+;;   - backaddress (see `org-koma-letter-use-backaddress')
+;;   - foldmarks (see `org-koma-letter-use-foldmarks')
+;;   - phone (see `org-koma-letter-use-phone')
+;;   - email (see `org-koma-letter-use-email')
+;;   - place (see `org-koma-letter-use-place')
+;;   - subject, a list of format options
+;; (see `org-koma-letter-subject-format')
+;;   - after-closing-order, a list of the ordering of headings with
+;; special tags after closing (see
+;; `org-koma-letter-special-tags-after-closing') -
+;; after-letter-order, as above, but after the end of the letter
+;; (see `org-koma-letter-special-tags-after-letter').
+;;
+;; The following variables works differently from the main LaTeX class
+;;   - AUTHOR: default to user-full-name but may be disabled.  (see org-koma-letter-author),
+;;   - EMAIL: same as AUTHOR, (see org-koma-letter-email),
+;;
+;; Headlines are in general ignored.  However, headlines with special
+;; tags can be used for specified contents like postscript (ps),
+;; carbon copy (cc), enclosures (encl) and code to be inserted after
+;; \end{letter} (after_letter).  Specials tags are defined in
+;; `org-koma-letter-special-tags-after-closing' and
+;; `org-koma-letter-special-tags-after-letter'.  Currently members of
+;; `org-koma-letter-special-tags-after-closing' used as macros and the
+;; content of the headline is the argument.
 ;;
 ;; You will need to add an appropriate association in
 ;; `org-latex-classes' in order to use the KOMA Scrlttr2 class.  For
@@ -93,7 +124,7 @@ string.
   :type '(radio (function-item user-full-name)
 		(string)
 		(function)
-		(const nil)))
+		(const :tag Do not export author nil)))
 
 (defcustom org-koma-letter-email 'org-koma-letter-email
   The sender's email address.
@@ -105,7 +136,7 @@ function may be given.  Functions must return a string.
   :type '(radio (function-item org-koma-letter-email)
 		(string)
 		(function)
-		(const nil)))
+		(const :tag Do not export email nil)))
 
 (defcustom org-koma-letter-from-address nil
   Sender's address, as a string.
@@ -153,17 +184,19 @@ writing the following values are allowed:
 
 Please refer to the KOMA-script manual (Table 4.16. in the
 English manual of 2012-07-22)
-  :type '(set   (const  

Re: [O] [patch][ox-koma-letter] Support for to and from headings

2013-06-04 Thread Bastien
Hi Rasmus,

Rasmus ras...@gmx.us writes:

 * ox-koma-letter.el: If tag wasn't given a headline could cause
   trouble.
 * ox-koma-letter.el: bug in subject-format defcustom.
 * ox-koma-letter.el: some newline changes
 * ox-koma-letter.el: changed varioues quoted things to symbols.

You need to tell what functions or variables are modified.

Simply open the diff in Emacs, use `n' to navigate to the
next difference, then hit `C-x 4 a' to create a changelog 
entry, Emacs change-log-mode will handle the formatting
correctly.

Hope this helps!

-- 
 Bastien



Re: [O] [patch][ox-koma-letter] Support for to and from headings

2013-06-04 Thread Rasmus
Bastien,

 * ox-koma-letter.el: If tag wasn't given a headline could cause
   trouble.
 * ox-koma-letter.el: bug in subject-format defcustom.
 * ox-koma-letter.el: some newline changes
 * ox-koma-letter.el: changed varioues (sic) quoted things to symbols.

 You need to tell what functions or variables are modified.

 Simply open the diff in Emacs, use `n' to navigate to the
 next difference, then hit `C-x 4 a' to create a changelog 
 entry, Emacs change-log-mode will handle the formatting
 correctly.

 Hope this helps!

Yes it does as I wasn't aware of that function.  I'll try to update
with a proper patch. 

Please do let me know if you find other mistakes. 

–Rasmus

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



Re: [O] [patch][ox-koma-letter] Support for to and from headings

2013-06-03 Thread Rasmus
Rasmus ras...@gmx.us writes:

 Hi,

 Some more patches that should work against the master branch.

 Patch 1: bug fixes.  Most notably use symbols some places rather than
 strings.

 Patch 2 adds support for TO and FROM headings.  If you've got time for
 testing I would appreciate feedback.  It's explained in the top of the
 patch.

Patch 1 and 2 are updated.  Patch three adds support for an
`org-koma-letter-default-class' and a plug-in function to make it
easier to use letters.  They should apply against master.

–Rasmus

--
If you can mix business and politics wonderful things can happen!
From 4c993600fb032e91a0122520a1e41c0f8d1caade Mon Sep 17 00:00:00 2001
From: rasmus.pank rasmus.p...@gmail.com
Date: Mon, 27 May 2013 17:29:14 +0200
Subject: [PATCH 1/3] Bug fixes for ox-koma-letter.el

* ox-koma-letter.el: If tag wasn't given a headline could cause
  trouble.
* ox-koma-letter.el: bug in subject-format defcustom.
* ox-koma-letter.el: some newline changes
* ox-koma-letter.el: changed varioues quoted things to symbols.
* ox-koma-letter.el: updated documentation in the top of the file.
---
 contrib/lisp/ox-koma-letter.el | 106 +++--
 1 file changed, 71 insertions(+), 35 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 4af0ba7..f1b18bf 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -33,12 +33,37 @@
 ;;
 ;; On top of buffer keywords supported by `latex' back-end (see
 ;; `org-latex-options-alist'), this back-end introduces the following
-;; keywords: CLOSING (see `org-koma-letter-closing'), FROM_ADDRESS
-;; (see `org-koma-letter-from-address'), LCO (see
-;; `org-koma-letter-class-option-file'), OPENING (see
-;; `org-koma-letter-opening'), PHONE_NUMBER (see
-;; `org-koma-letter-phone-number'), SIGNATURE (see
-;; `org-koma-letter-signature') and TO_ADDRESS.
+;; keywords:
+;;   - CLOSING (see `org-koma-letter-closing'),
+;;   - FROM_ADDRESS (see `org-koma-letter-from-address'),
+;;   - LCO (see `org-koma-letter-class-option-file'),
+;;   - OPENING (see `org-koma-letter-opening'),
+;;   - PHONE_NUMBER (see `org-koma-letter-phone-number'),
+;;   - SIGNATURE (see `org-koma-letter-signature')
+;;   - PLACE (see `org-koma-letter-place')
+;;   - and TO_ADDRESS.
+;;
+;; A number of OPTIONS settings can be set to change which contents is exported.
+;;   - backaddress (see `org-koma-letter-use-backaddress')
+;;   - foldmarks (see `org-koma-letter-use-foldmarks')
+;;   - phone (see `org-koma-letter-use-phone')
+;;   - email (see `org-koma-letter-use-email')
+;;   - place (see `org-koma-letter-use-place')
+;;   - subject, a list of format options
+;; (see `org-koma-letter-subject-format')
+;;   - after-closing-order, a list of ordering after letter
+;; (see `org-koma-letter-special-tags-after-closing')
+;;   - after-letter-order, as above
+;; (see `org-koma-letter-special-tags-after-letter').
+;;
+;; The following variables works differently from the main LaTeX class
+;;   - AUTHOR: default to user-full-name but may be disabled.  (see org-koma-letter-author),
+;;   - EMAIL: same as AUTHOR, (see org-koma-letter-email),
+;;
+;; Headlines are in general ignored.  However, headlines with special
+;; tags can be used for specified contents like postscript (ps), carbon
+;; copy (cc), commencements (encl) and code to be inserted after
+;; \end{letter} (after_letter).
 ;;
 ;; You will need to add an appropriate association in
 ;; `org-latex-classes' in order to use the KOMA Scrlttr2 class.  For
@@ -93,7 +118,7 @@ string.
   :type '(radio (function-item user-full-name)
 		(string)
 		(function)
-		(const nil)))
+		(const :tag Do not export author nil)))
 
 (defcustom org-koma-letter-email 'org-koma-letter-email
   The sender's email address.
@@ -105,7 +130,7 @@ function may be given.  Functions must return a string.
   :type '(radio (function-item org-koma-letter-email)
 		(string)
 		(function)
-		(const nil)))
+		(const :tag Do not export email nil)))
 
 (defcustom org-koma-letter-from-address nil
   Sender's address, as a string.
@@ -153,17 +178,19 @@ writing the following values are allowed:
 
 Please refer to the KOMA-script manual (Table 4.16. in the
 English manual of 2012-07-22)
-  :type '(set   (const  afteropening)
-		(const  beforeopening)
-		(const  centered)
-		(const  left)
-		(const  right)
-		(const  underlined)
-		(const  titled)
-		(const  untitled)
-		(const :tag No export nil)
-		(const :tag Default options t)
-		(string))
+  :type '(radio
+	  (const :tag No export nil)
+	  (const :tag Default options t)
+	  (set :tag selection
+	   (const  'afteropening)
+	   (const  'beforeopening)
+	   (const  'centered)
+	   (const  'left)
+	   (const  'right)
+	   (const  'underlined)
+	   (const  'titled)
+	   (const  'untitled))
+	  (string))
   :group 'org-export-koma-letter)
 
 
@@ -198,15 +225,16 @@ Use `foldmarks:true' to activate default fold marks or
   :group 'org-export-koma-letter

[O] [patch][ox-koma-letter] Support for to and from headings

2013-06-01 Thread Rasmus

Hi,

Some more patches that should work against the master branch.

Patch 1: bug fixes.  Most notably use symbols some places rather than
strings.

Patch 2 adds support for TO and FROM headings.  If you've got time for
testing I would appreciate feedback.  It's explained in the top of the
patch.

–Rasmus

-- 
This is the kind of tedious nonsense up with which I will not put
From 8cc0953849b7b3e7d791c7ad4fd4a9a71581ada5 Mon Sep 17 00:00:00 2001
From: rasmus.pank rasmus.p...@gmail.com
Date: Mon, 27 May 2013 17:29:14 +0200
Subject: [PATCH 1/2] Bug fixes for ox-koma-letter.el

* ox-koma-letter.el: If tag wasn't given a headline could cause
  trouble.
* ox-koma-letter.el: bug in subject-format defcustom.
* ox-koma-letter.el: some newline changes
* ox-koma-letter.el: changed varioues quoted things to symbols.
---
 contrib/lisp/ox-koma-letter.el | 51 +++---
 1 file changed, 28 insertions(+), 23 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 4af0ba7..82bdf33 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -93,7 +93,7 @@ string.
   :type '(radio (function-item user-full-name)
 		(string)
 		(function)
-		(const nil)))
+		(const :tag Do not export author nil)))
 
 (defcustom org-koma-letter-email 'org-koma-letter-email
   The sender's email address.
@@ -105,7 +105,7 @@ function may be given.  Functions must return a string.
   :type '(radio (function-item org-koma-letter-email)
 		(string)
 		(function)
-		(const nil)))
+		(const :tag Do not export email nil)))
 
 (defcustom org-koma-letter-from-address nil
   Sender's address, as a string.
@@ -153,17 +153,19 @@ writing the following values are allowed:
 
 Please refer to the KOMA-script manual (Table 4.16. in the
 English manual of 2012-07-22)
-  :type '(set   (const  afteropening)
-		(const  beforeopening)
-		(const  centered)
-		(const  left)
-		(const  right)
-		(const  underlined)
-		(const  titled)
-		(const  untitled)
-		(const :tag No export nil)
-		(const :tag Default options t)
-		(string))
+  :type '(radio
+	  (const :tag No export nil)
+	  (const :tag Default options t)
+	  (set :tag selection
+	   (const  'afteropening)
+	   (const  'beforeopening)
+	   (const  'centered)
+	   (const  'left)
+	   (const  'right)
+	   (const  'underlined)
+	   (const  'titled)
+	   (const  'untitled))
+	  (string))
   :group 'org-export-koma-letter)
 
 
@@ -198,15 +200,16 @@ Use `foldmarks:true' to activate default fold marks or
   :group 'org-export-koma-letter
   :type 'boolean)
 
-(defconst org-koma-letter-special-tags-after-closing
-  '(ps encl cc)
+
+
+(defconst org-koma-letter-special-tags-after-closing '(ps encl cc)
   Header tags to be inserted after closing)
 
-(defconst org-koma-letter-special-tags-after-letter '(after_letter)
+(defconst org-koma-letter-special-tags-after-letter '(after_letter)
   Header tags to be inserted after closing)
 
-(defvar org-koma-letter-special-contents nil holds special
-content temporarily.)
+(defvar org-koma-letter-special-contents nil
+  holds special content temporarily.)
 
 
 
@@ -286,9 +289,10 @@ is t the content in `org-koma-letter-special-contents' will not
 be wrapped in a macro named whatever the members of a-list are called.
 
   (let (output)
-(dolist (ac a-list output)
-  (let
-	  ((x (org-koma-letter--get-tagged-contents ac))
+(dolist (ac* a-list output)
+  (let*
+	  ((ac (cond ((symbolp ac*) (symbol-name ac*)) (t ac*)))
+	   (x (org-koma-letter--get-tagged-contents ac))
 	   (regexp (if keep-newlines  \\`\n+\\|\n*\\')))
 	(when x
 	  (setq output
@@ -354,8 +358,9 @@ appropriate place.
   (let*
   ((tags (and (plist-get info :with-tags)
 		 (org-export-get-tags headline info)))
-   (tag (downcase (car tags
-(if (member tag (plist-get info :special-tags))
+   (tag (if tags  (downcase (car tags)
+(if (member tag
+		(mapcar 'symbol-name (plist-get info :special-tags)))
 	(progn
 	  (push (cons tag contents)
 		org-koma-letter-special-contents)
-- 
1.8.3

From 7fbc3b4b9ef742b895b1af67ba1a05c93d511eea Mon Sep 17 00:00:00 2001
From: rasmus ras...@gmx.us
Date: Sat, 1 Jun 2013 19:52:36 +0200
Subject: [PATCH 2/2] Added support for to and from heading.

* ox-koma-letter.el (org-koma-letter-special-tags-in-letter): list of
tags that are typeset as part of the letter.  *
ox-koma-letter.el (org-koma-letter--determine-special-value):
determine which value to use (for to and from currentlly) if more than
candidate is available.  Which value is selected depends on
`org-koma-letter-prefer-special-headings'.  *
ox-koma-letter.el (org-koma-letter-prefer-special-headings): a boolean
stating whether to prefer headings with to/from or the #+X_ADDRESS.

The following letter now exports as expected.  In particular when
special-headings is t heading values have presedence so the
from address would be =Rasmus\nEmacs\nOrg-mode= where the
=\n=s would be escaped.  If