From mboxrd@z Thu Jan 1 00:00:00 1970 From: Viktor Rosenfeld Subject: [PATCH] [contrib/org-koma-letter.el] Configurable subject title and place and signature bugfix Date: Fri, 28 Dec 2012 23:53:21 +0100 Message-ID: <20121228225321.GB4659@kenny.fritz.box> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="bCsyhTFzCvuiizWE" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:57238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Toiny-0007Eq-8N for emacs-orgmode@gnu.org; Fri, 28 Dec 2012 17:53:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Toinv-0005LW-0T for emacs-orgmode@gnu.org; Fri, 28 Dec 2012 17:53:30 -0500 Received: from mail-bk0-f53.google.com ([209.85.214.53]:45334) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Toinu-0005LP-Nz for emacs-orgmode@gnu.org; Fri, 28 Dec 2012 17:53:26 -0500 Received: by mail-bk0-f53.google.com with SMTP id j5so4822959bkw.26 for ; Fri, 28 Dec 2012 14:53:25 -0800 (PST) Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --bCsyhTFzCvuiizWE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --bCsyhTFzCvuiizWE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="org-koma-letter.patch" 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) + ;;; 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)) --bCsyhTFzCvuiizWE--