From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: [patch] ox-koma-letter.el: subject changes [2/4] Date: Mon, 20 May 2013 02:40:41 +0200 Message-ID: <87obc6scty.fsf@pank.eu> References: <87wqqusder.fsf@pank.eu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:55357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeE9h-0006gs-GT for emacs-orgmode@gnu.org; Sun, 19 May 2013 20:40:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UeE9e-0005iS-Oq for emacs-orgmode@gnu.org; Sun, 19 May 2013 20:40:49 -0400 Received: from mout.gmx.net ([212.227.15.15]:52524) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeE9e-0005iK-FN for emacs-orgmode@gnu.org; Sun, 19 May 2013 20:40:46 -0400 In-Reply-To: <87wqqusder.fsf@pank.eu> (rasmus@gmx.us's message of "Mon, 20 May 2013 02:28:12 +0200") 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 Cc: alan.schmitt@polytechnique.org, n.goaziou@gmail.com --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable This could be a problematic change. It changes the way :with-subject works. I've added changes to allow the subject style to be choose as a radio list with customize. The reason is that LaTeX becomes unhappy if it is not a supported value. If #+OPTIONS subject:t the default is used. If #+OPTIONS subject:my-crazy-string it tries that and most likely hell will break loose. Viktor, you're usage of ox-koma-letter.el is quite different from mine in that you rely (heavily?) on LCO files. If you could test this and see what you think of it it would be great. On my system it doesn't break anything vital but I might have missed something.=20=20 I have probably overlooked some important case in which case I can try to fix the patch or drop it. =E2=80=93Rasmus --=20 El Rey ha muerto. =C2=A1Larga vida al Rey! --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-ox-koma-letter-changed-handling-of-subject.patch >From 3847d0074c23d782abb1756a35b2cf44175f8684 Mon Sep 17 00:00:00 2001 From: "rasmus.pank" Date: Sun, 19 May 2013 17:32:44 +0200 Subject: [PATCH 2/4] ox-koma-letter: changed handling of subject * ox-koma-letter.el: org-koma-letter-subject-format is now a radio list. If nil neither subject format nor type is exported. * ox-koma-letter.el: allow for t value of #+OPTIONS: subject:VALUE * ox-koma-letter.el: export of subject format is independent of title, but title is not independent of :with-subject. The issue is that I could select #+OPTIONS: subject:t and this would give a wrong value. Hopefully this bevaior is better. --- contrib/lisp/ox-koma-letter.el | 55 +++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el index 2389025..77d21c7 100644 --- a/contrib/lisp/ox-koma-letter.el +++ b/contrib/lisp/ox-koma-letter.el @@ -6,7 +6,6 @@ ;; Alan Schmitt ;; Viktor Rosenfeld ;; Rasmus Pank Roulund - ;; Keywords: org, wp, tex ;; This program is free software: you can redistribute it and/or modify @@ -123,10 +122,36 @@ :group 'org-export-koma-letter :type 'string) -(defcustom org-koma-letter-use-subject "untitled" - "Use the title as the letter's subject." - :group 'org-export-koma-letter - :type 'string) +(defcustom org-koma-letter-subject-format "left" + "Use the title as the letter's subject. At the time of writing +the following values are allowed: + + - fteropening: subject after opening + - beforeopening: subject before opening + - centered: subject centered + - left:subject left-justified + - right: subject right-justified + - titled: add title/description to subject + - underlined: set subject underlined (see note in text please) + - untitled: do not add title/description to subject. + - No-export: like untitled but the title is not inserted into + the exported document. + +Please refer to the KOMA-script manual (Table 4.16. in the +English manual of 2012-07-22)" + :type '(radio (const "fteropening") + (const "beforeopening") + (const "centered") + (const "left") + (const "right") + (const "titled") + (const "underlined") + (const "untitled") + (const :tag "No-export" nil) + (string)) + :group 'org-export-koma-letter) + + (defcustom org-koma-letter-use-backaddress t "Print return address in small line above to address." @@ -179,7 +204,7 @@ Use `foldmarks:true' to activate default fold marks or (:with-phone nil "phone" org-koma-letter-use-phone) (:with-email nil "email" org-koma-letter-use-email) (:with-place nil "place" org-koma-letter-use-place) - (:with-subject nil "subject" org-koma-letter-use-subject)) + (:with-subject nil "subject" org-koma-letter-subject-format)) :translate-alist '((export-block . org-koma-letter-export-block) (export-snippet . org-koma-letter-export-snippet) (keyword . org-koma-letter-keyword) @@ -300,12 +325,18 @@ holding export options." ;; Document start "\\begin{document}\n\n" ;; Subject - (let ((with-subject (plist-get info :with-subject))) - (when with-subject - (concat - (format "\\KOMAoption{subject}{%s}\n" with-subject) - (format "\\setkomavar{subject}{%s}\n\n" - (org-export-data (plist-get info :title) info))))) + (let* ((with-subject (plist-get info :with-subject)) + (subject-format (if (member with-subject '("True" t "true" "TRUE")) + ;; FIXME: could this be done more elegantly? + ;; I.e. force lower face of with-subject if string. + org-koma-letter-subject-format + with-subject)) + (subject (org-export-data (plist-get info :title) info))) + (concat + (when with-subject + (format "\\KOMAoption{subject}{%s}\n\n" subject-format)) + (when (and subject with-subject) + (format "\\setkomavar{subject}{%s}\n\n" subject)))) ;; Letter start (format "\\begin{letter}{%%\n%s}\n\n" (or (plist-get info :to-address) "no address given")) -- 1.8.2.3 --=-=-=--