From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: [patch] ox-koma-letter.el: subject changes [2/4]
Date: Mon, 20 May 2013 20:23:00 +0200 [thread overview]
Message-ID: <87y5b9o6ij.fsf@pank.eu> (raw)
In-Reply-To: m2hahxtzws.fsf@polytechnique.org
[-- Attachment #1: Type: text/plain, Size: 1502 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.
>
> According to my very limited emacs-lisp knowledge, this looks fine.
I found a "bug" in that the subject variable should be a list cf. the
KOMA manual. This patch fixes this.
It's pretty complex for something so simple, and I might be inclined
to admit to the "put it in a LCO"-file approach might be better.
From the commit message:
If =#+OPTIONS:subject:nil= neither =\setkomavar{subject}{.}= nor
=\KOMAoption{subject}{.}= are exported.
If =#+OPTIONS:subject:t= =`org-koma-letter-subject-format'= is used
for =\KOMAoption{subject}{.}=.
If =#+OPTIONS:subject:(x y z)= then =\KOMAoption{subject}{x,y,z}=.
> beavior -> behavior
> fteropening -> afteropening
> No-export -> noexport (so that it looks like the other ones).
Thanks! I should run wcheck when coding . . .
–Rasmus
--
Powered by magic pixies!
[-- 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: 4627 bytes --]
From d11e4fd682ac593da04c3e4c8edf5eb84c9d0c59 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
set 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 was with =#+OPTIONS: subject:t= one would get a LaTeX.
New behavior:
If =#+OPTIONS:subject:nil= neither =\setkomavar{subject}{.}= nor
=\KOMAoption{subject}{.}= are exported.
If =#+OPTIONS:subject:t= =`org-koma-letter-subject-format'= is used
for =\KOMAoption{subject}{.}=.
If =#+OPTIONS:subject:(x y z)= then \KOMAoption{subject}{x,y,z}.
---
contrib/lisp/ox-koma-letter.el | 65 ++++++++++++++++++++++++++++++++++--------
1 file changed, 53 insertions(+), 12 deletions(-)
diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 2389025..6a3811f 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,35 @@
: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 '("beforeopening" "left" "untitled")
+ "Use the title as the subject of the letter. At the time of
+writing the following values are allowed:
+
+ - afteropening: 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: do no insert a subject even if present.
+
+Please refer to the KOMA-script manual (Table 4.16. in the
+English manual of 2012-07-22)"
+ :type '(set (const "afteropening")
+ (const "beforeopening")
+ (const "centered")
+ (const "left")
+ (const "right")
+ (const "underlined")
+ (const "titled")
+ (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 +203,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 +324,29 @@ 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
+ ;; test if subject-format is t
+ (cond ((symbolp with-subject) (downcase (symbol-name with-subject)))
+ ((stringp with-subject) (downcase with-subject))
+ (t nil))
+ '("true" "t"))
+ org-koma-letter-subject-format
+ with-subject))
+ (subject (org-export-data (plist-get info :title) info))
+ (l (if (stringp subject-format) 1 (length subject-format)))
+ (y ""))
+ (concat
+ (when with-subject
+ (concat
+ "\\KOMAoption{subject}{"
+ (apply 'format
+ (dotimes (x l y)
+ (setq y (concat (if (> x 0) "%s," "%s") y)))
+ subject-format) "}\n"))
+ (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
next prev parent reply other threads:[~2013-05-20 18:23 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 ` [patch] ox-koma-letter.el: subject changes [2/4] Rasmus
2013-05-20 15:49 ` Alan Schmitt
2013-05-20 18:23 ` Rasmus [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y5b9o6ij.fsf@pank.eu \
--to=rasmus@gmx.us \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.