emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Cc: alan.schmitt@polytechnique.org, n.goaziou@gmail.com
Subject: [patch] ox-koma-letter.el: subject changes [2/4]
Date: Mon, 20 May 2013 02:40:41 +0200	[thread overview]
Message-ID: <87obc6scty.fsf@pank.eu> (raw)
In-Reply-To: <87wqqusder.fsf@pank.eu> (rasmus@gmx.us's message of "Mon, 20 May 2013 02:28:12 +0200")

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


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.  

I have probably overlooked some important case in which case I can try
to fix the patch or drop it.

–Rasmus

-- 
El Rey ha muerto. ¡Larga vida al Rey!

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-ox-koma-letter-changed-handling-of-subject.patch --]
[-- Type: text/x-patch, Size: 4166 bytes --]

From 3847d0074c23d782abb1756a35b2cf44175f8684 Mon Sep 17 00:00:00 2001
From: "rasmus.pank" <rasmus.pank@gmail.com>
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 <alan.schmitt AT polytechnique DOT org>
 ;;         Viktor Rosenfeld <listuser36 AT gmail DOT com>
 ;;         Rasmus Pank Roulund <emacs AT pank DOT eu>
-
 ;; 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


  reply	other threads:[~2013-05-20  0:40 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-20  0:28 [patch] ox-koma-letter.el: credit [1/4] Rasmus
2013-05-20  0:40 ` Rasmus [this message]
2013-05-20 15:49   ` [patch] ox-koma-letter.el: subject changes [2/4] Alan Schmitt
2013-05-20 18:23     ` Rasmus
2013-05-21  7:24       ` Alan Schmitt
2013-05-21 15:52         ` Viktor Rosenfeld
2013-05-21 17:48           ` Rasmus
2013-05-20  0:51 ` [patch] ox-koma-letter.el: credit [3/4] Rasmus
2013-05-20 15:52   ` Alan Schmitt
2013-05-21 16:56   ` Viktor Rosenfeld
2013-05-21 17:35     ` Rasmus
2013-05-21 20:06       ` Viktor Rosenfeld
     [not found]         ` <87zjvo7xkl.fsf@pank.eu>
     [not found]           ` <20130522145312.GB61443@kenny.local>
2013-05-22 17:16             ` Rasmus
2013-05-22 17:38               ` Viktor Rosenfeld
2013-05-20  0:54 ` [patch] ox-koma-letter.el: clean-up/semantic bug [4/4] Rasmus
     [not found]   ` <m2ehd1tziq.fsf@polytechnique.org>
2013-05-21  9:05     ` Rasmus
2013-05-21 11:32       ` Alan Schmitt
2013-05-21 12:22         ` Rasmus
2013-05-21 17:02           ` Viktor Rosenfeld
2013-05-21 18:13             ` Rasmus
2013-05-21 19:54               ` Viktor Rosenfeld
2013-05-21 23:23                 ` Rasmus
2013-05-22 14:39                   ` Viktor Rosenfeld
2013-05-22 22:06                     ` [PATCH] ox-koma-letter.el: Reintroduce variables removed in commit 832c6fd with proper defaults (was Re: [patch] ox-koma-letter.el: clean-up/semantic bug [4/4]) Viktor Rosenfeld
2013-05-25  5:13                       ` Robert Klein
2013-05-25  8:05                         ` Viktor Rosenfeld
2013-05-25  9:20                           ` Alan Schmitt
2013-05-25 13:57                             ` Rasmus
2013-05-25 17:03                               ` Viktor Rosenfeld
2013-05-25 17:48                                 ` [PATCH][ox-koma-letter]: sender, email and cleanup (was: [PATCH] ox-koma-letter.el: Reintroduce variables removed in commit 832c6fd with proper defaults) Rasmus
2013-05-25 21:27                                   ` [PATCH][ox-koma-letter]: sender, email and cleanup Rasmus
2013-05-26 10:58                                     ` Viktor Rosenfeld
2013-05-26 14:38                                       ` Rasmus
2013-05-26 10:54                                   ` [PATCH][ox-koma-letter]: sender, email and cleanup (was: [PATCH] ox-koma-letter.el: Reintroduce variables removed in commit 832c6fd with proper defaults) Viktor Rosenfeld
2013-05-26 14:36                                     ` [PATCH][ox-koma-letter]: sender, email and cleanup Rasmus
2013-05-27  6:25                                       ` Alan Schmitt
2013-05-27  9:22                                         ` Xavier Garrido
2013-05-27  9:51                                           ` Rasmus
2013-05-27 18:31                                           ` Viktor Rosenfeld
2013-05-27 20:42                                             ` Xavier Garrido
2013-05-26 14:51                                     ` Rasmus
2013-05-25 20:51                               ` [PATCH] ox-koma-letter.el: Reintroduce variables removed in commit 832c6fd with proper defaults (was Re: [patch] ox-koma-letter.el: clean-up/semantic bug [4/4]) Robert Klein
2013-05-25 21:41                                 ` [PATCH] ox-koma-letter.el: Reintroduce variables removed in commit 832c6fd with proper defaults Rasmus
2013-05-26 11:04                                 ` [PATCH] ox-koma-letter.el: Reintroduce variables removed in commit 832c6fd with proper defaults (was Re: [patch] ox-koma-letter.el: clean-up/semantic bug [4/4]) Viktor Rosenfeld
2013-05-20 15:44 ` [patch] ox-koma-letter.el: credit [1/4] Alan Schmitt
2013-05-20 15:49   ` Rasmus
2013-05-20 16:01     ` Alan Schmitt
2013-05-21 17:06 ` Viktor Rosenfeld

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=87obc6scty.fsf@pank.eu \
    --to=rasmus@gmx.us \
    --cc=alan.schmitt@polytechnique.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@gmail.com \
    /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).