emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] [contrib/org-koma-letter.el] Configurable subject title and place and signature bugfix
@ 2012-12-28 22:53 Viktor Rosenfeld
  2012-12-29 10:32 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Viktor Rosenfeld @ 2012-12-28 22:53 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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))

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

* Re: [PATCH] [contrib/org-koma-letter.el] Configurable subject title and place and signature bugfix
  2012-12-28 22:53 [PATCH] [contrib/org-koma-letter.el] Configurable subject title and place and signature bugfix Viktor Rosenfeld
@ 2012-12-29 10:32 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2012-12-29 10:32 UTC (permalink / raw)
  To: emacs-orgmode

Hi Viktor,

Viktor Rosenfeld <listuser36@gmail.com> writes:

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

Thanks for this.  

Can you resubmit the patch and add a commit changelog?
See http://orgmode.org/worg/org-contribute.html#sec-4

Best,

-- 
 Bastien

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

end of thread, other threads:[~2012-12-29 10:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-28 22:53 [PATCH] [contrib/org-koma-letter.el] Configurable subject title and place and signature bugfix Viktor Rosenfeld
2012-12-29 10:32 ` Bastien

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).