emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: [patch] ox-koma-letter
Date: Mon, 25 Feb 2013 21:25:58 +0100	[thread overview]
Message-ID: <87vc9gkund.fsf@pank.eu> (raw)

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

Hi,

I have been working on extending the KOMA letter support in Org.  The
backend is still rough and I would like to more stuff such as
designing firstfood and firsthead with org elements (e.g. I use a
tabularx for my firstfood with varioues stuff).

I have changed the following objects:

  1. Make keys sane; no reason why open pdf is O rather than o and why
     k is used in place of l (as in the tex exporter).
  2. Added AFTER_CLOSING and AFTER_LETTER keywords for arbitrary code
     after \closing{.} and \end{letter}, respectively.
     a. A weird bug I don't understand is why I cannot have
        #+AFTER_CLOSING{\ps{ps:}}
     b. Would it be better to have a dedicated, say, PS and ENCL rather
        than the generic AFTER_CLOSING?
  3. Added from-bank, invoice and other keywords like that.  Still
     many to go, but some of them would probably need some thought.
     For instance firstfoot should work differently depending on
     whether it is given a NAMEd table or a string.  Any though? 

I'm not a good programmer, so if someone could look through it, and
say whether it's OK it'd be happy to work more on in and submit it a
proper patch if deemed worthy.

Also, if someone has thoughts on how to improve the letter experience
that would be interesting to hear.  

I'd love to hear an explanation of point a. above.

Further, perhaps we should remove all the silly defaults from the
defcustoms in ox-koma-letter?  

–Rasmus

-- 
. . . Stallman was indeed the tallest possible mountain and by
standing on his shoulders you could see forever. . .

[-- Attachment #2: koma.diff --]
[-- Type: text/plain, Size: 4111 bytes --]

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 07633e3..069d458 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -91,6 +91,23 @@
   :group 'org-export-koma-letter
   :type 'string)
 
+(defcustom org-koma-letter-from-bank ""
+  "Sender's bank account, as a string."
+  :group 'org-export-koma-letter
+  :type 'string)
+
+(defcustom org-koma-letter-from-fax ""
+  "Sender's fax number, as a string."
+  :group 'org-export-koma-letter
+  :type 'string)
+
+(defcustom org-koma-letter-from-url ""
+  "Sender's url, as a string."
+  :group 'org-export-koma-letter
+  :type 'string)
+
+
+
 (defcustom org-koma-letter-opening "Dear Sir,"
   "Letter's opening, as a string."
   :group 'org-export-koma-letter
@@ -106,33 +123,42 @@
   :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)
+  ((:after-closing "AFTER_CLOSING" nil "" newline)
+   (:after-letter "AFTER_LETTER" nil "" newline)
+   (:closing "CLOSING" nil org-koma-letter-closing)
    (:from-address "FROM_ADDRESS" nil org-koma-letter-from-address newline)
+   (:from-bank "FROM_BANK" nil org-koma-letter-from-bank t)
+   (:from-fax "FROM_FAX" nil org-koma-letter-from-fax t)
+   (:from-url "FROM_FAX" nil org-koma-letter-from-url t)
+   (:invoice "INVOICE" nil "" t)
+   (:my-ref "MY_REF" nil "" t)
+   (:your-ref "YOUR_REF" nil "" t)
    (: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))
+   (:signature "SIGNATURE" nil user-full-name newline)
+   (:to-address "TO_ADDRESS" nil nil newline)
+   )
   :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))))))))
 
-\f
+
 ;;; Transcode Functions
 
 ;;;; Export Block
@@ -204,7 +230,15 @@ holding export options."
    (format "\\setkomavar{signature}{%s}\n" (plist-get info :signature))
    (format "\\setkomavar{fromemail}{%s}\n"
            (org-export-data (plist-get info :email) info))
+   (format "\\setkomavar{frombank}{%s}\n"
+           (org-export-data (plist-get info :from-bank) info))
    (format "\\setkomavar{fromphone}{%s}\n" (plist-get info :phone-number))
+   (format "\\setkomavar{frombank}{%s}\n" (plist-get info :from-bank))
+   (format "\\setkomavar{fromfax}{%s}\n" (plist-get info :from-fax))
+   (format "\\setkomavar{fromurl}{%s}\n" (plist-get info :from-url))
+   (format "\\setkomavar{myref}{%s}\n" (plist-get info :my-ref))
+   (format "\\setkomavar{yourref}{%s}\n" (plist-get info :your-ref))
+   (format "\\setkomavar{invoice}{%s}\n" (plist-get info :invoice))
    ;; Date.
    (format "\\date{%s}\n" (org-export-data (plist-get info :date) info))
    ;; Letter Class Option File
@@ -221,11 +255,13 @@ holding export options."
    contents
    ;; Closing.
    (format "\n\\closing{%s}\n\n" (plist-get info :closing))
+   (format "\n%s\n" (plist-get info :after-closing))
    ;; Letter end.
-   "\\end{letter}\n\\end{document}"))
+   "\\end{letter}\n\n"
+   (format "%s" (plist-get info :after-letter))
+   "\\end{document}"))
 
 
-\f
 ;;; Commands
 
 ;;;###autoload

             reply	other threads:[~2013-02-25 20:26 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-25 20:25 Rasmus [this message]
2013-02-26  9:50 ` [patch] ox-koma-letter Bastien
2013-02-26 11:53   ` Rasmus
2013-02-26 12:38 ` Michael Strey
2013-02-26 21:14   ` Rasmus
2013-02-27 10:51     ` Michael Strey
2013-02-27 12:13       ` Rasmus
2013-02-27 13:41         ` Sebastien Vauban
2013-02-27 16:48           ` Rasmus
2013-02-28 15:19         ` Michael Strey
2013-03-02 17:53           ` Rasmus
2013-03-01 13:17 ` Alan Schmitt
2013-03-02 10:26   ` Bastien
2013-03-02 15:50     ` Alan Schmitt
2013-03-02 18:12       ` Bastien
2013-03-02 17:54   ` Rasmus
2013-03-02 17:57   ` Rasmus
2013-03-02 19:21     ` Alan Schmitt
2013-03-02 21:58       ` Rasmus
2013-03-03 16:00         ` Alan Schmitt
2013-03-03 17:25           ` Nicolas Goaziou
2013-03-04  7:19             ` Alan Schmitt
2013-03-04  8:33               ` Nicolas Goaziou
2013-03-04  8:56                 ` Alan Schmitt
2013-03-04 10:38                   ` Rasmus
2013-03-04 20:38                     ` Nicolas Goaziou
2013-03-05  9:08                       ` Alan Schmitt
2013-03-05  9:52                         ` Nicolas Goaziou
2013-03-05 10:51                       ` Michael Strey
2013-03-05 12:23                         ` Rasmus
2013-03-05 13:09                           ` Michael Strey
2013-03-06  9:03                         ` Alan Schmitt
2013-03-06  9:09                           ` Nicolas Goaziou
2013-03-04 10:46               ` Michael Strey
2013-03-04 13:48                 ` Alan Schmitt
2013-03-04 21:20                 ` Rasmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vc9gkund.fsf@pank.eu \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).