emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Viktor Rosenfeld <listuser36@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] [contrib/org-koma-letter.el] Configurable subject title and place and signature bugfix
Date: Fri, 28 Dec 2012 23:53:21 +0100	[thread overview]
Message-ID: <20121228225321.GB4659@kenny.fritz.box> (raw)

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

Hi,

the attached patch adds the following options to the scrlttr2 exporter:

- #+PLACE, or org-koma-letter-place: the place before the date,
  e.g., "Berlin, 28. Dezember 2012"; the place is only typeset if this
  variable is defined
- #+SUBJECT_TITLE, or org-koma-letter-subject-title: the subject keyword
  on the subject line, e.g., the German "Betreff"

It also fixes the behavior if no signature is defined, i.e., it uses the
KOMA variable fromname as described in the documentation.

Cheers,
Viktor

[-- Attachment #2: org-koma-letter.patch --]
[-- Type: text/plain, Size: 2737 bytes --]

diff --git a/contrib/lisp/org-koma-letter.el b/contrib/lisp/org-koma-letter.el
index 58714d2..3094171 100644
--- a/contrib/lisp/org-koma-letter.el
+++ b/contrib/lisp/org-koma-letter.el
@@ -36,7 +36,9 @@
 ;; `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".
+;; `org-koma-letter-signature'), "SUBJECT_TITLE" (see
+;; `org-koma-letter-subject-title'), "PLACE" (see
+;; `org-koma-letter-place'), and "TO_ADDRESS".
 ;;
 ;; You will need to add an appropriate association in
 ;; `org-e-latex-classes' in order to use the KOMA Scrlttr2 class.  For
@@ -106,6 +108,16 @@
   :group 'org-export-koma-letter
   :type 'string)
 
+(defcustom org-koma-letter-subject-title "Subject\\usekomavar{subjectseparator}"
+  "String used as the title for the subject."
+  :group 'org-export-koma-letter
+  :type 'string)
+
+(defcustom org-koma-letter-place nil
+  "Sender's location, as a string."
+  :group 'org-export-koma-letter
+  :type 'string)
+
 \f
 ;;; Define Back-End
 
@@ -116,7 +128,9 @@
    (: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)
+   (:signature "SIGNATURE" nil org-koma-letter-signature newline)
+   (:subject-title "SUBJECT_TITLE" nil org-koma-letter-subject-title)
+   (:place "PLACE" nil org-koma-letter-place)
    (:to-address "TO_ADDRESS" nil nil newline))
   :translate-alist ((export-block . org-koma-letter-export-block)
                     (export-snippet . org-koma-letter-export-snippet)
@@ -205,14 +219,18 @@ holding export options."
    (format "\\setkomavar{fromemail}{%s}\n"
            (org-export-data (plist-get info :email) info))
    (format "\\setkomavar{fromphone}{%s}\n" (plist-get info :phone-number))
-   ;; Date.
+   ;; Place
+   (let ((place (plist-get info :place)))
+     (when place
+      (format "\\setkomavar{place}{%s}\n" place)))
+   ;; Date
    (format "\\date{%s}\n" (org-export-data (plist-get info :date) 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"
-           (org-export-data (plist-get info :title) info))
+   (format "\\setkomavar{subject}[%s]{%s}\n\n"
+           (plist-get info :subject-title) (org-export-data (plist-get info :title) info))
    (format "\\begin{letter}{%%\n%s}\n\n" (or (plist-get info :to-address) "no address given"))
    ;; Opening.
    (format "\\opening{%s}\n\n" (plist-get info :opening))

             reply	other threads:[~2012-12-28 22:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-28 22:53 Viktor Rosenfeld [this message]
2012-12-29 10:32 ` [PATCH] [contrib/org-koma-letter.el] Configurable subject title and place and signature bugfix Bastien

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=20121228225321.GB4659@kenny.fritz.box \
    --to=listuser36@gmail.com \
    --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).