emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH][ox-koma-letter]: sender, email and cleanup
Date: Sat, 25 May 2013 23:27:05 +0200	[thread overview]
Message-ID: <874ndqn42e.fsf@pank.eu> (raw)
In-Reply-To: 87bo7zlzln.fsf_-_@pank.eu

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

Rasmus <rasmus@gmx.us> writes:

>   4. Sets defcustom org-koma-letter-signature nil since that
>      corresponds to default scrlttr2 behavior anyway (p. 183 in the
>      manual).
>
> Re 4.: I'd like to do something similar to
> org-koma-letter-subject-format.  But I'm not sure how, at the moment
> (perhaps make t the default and associate it with the current default
> list).


This patch makes the subject option "easier" although still relying on
a list for multiple options (see the description in the patch).  The
default is t corresponding to do nothing but print komavar subject.

I haven't found any bugs but please test it (along with other patches)
if time permits.

A potential problem is that subject default to the file name and can
only be disabled with the option subject:nil.  The file name to title
convention is bad in ox-latex.el and I think it's if anything worse
here.  I'd like to make it nil by default.  What do you guys think?
  
–Rasmus

PS: Perhaps it would it be beneficial to make some test-letter
displaying the different scenarios in which we use ox-koma-letter?  To
make sure that stuff doesn't get broken.

--
May the Force be with you

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0005-Only-print-subject-options-when-necessary.patch --]
[-- Type: text/x-patch, Size: 2477 bytes --]

From 880f99622a4513520d1dd4e110428f18453a3af1 Mon Sep 17 00:00:00 2001
From: "rasmus.pank" <rasmus.pank@gmail.com>
Date: Sat, 25 May 2013 20:49:57 +0200
Subject: [PATCH 5/5] Only print subject options when necessary

* ox-koma-letter.el (org-koma-letter-subject-format): default is now t
* ox-koma-letter.el (org-koma-letter-template): better subject handling.

If =#+OPTIONS: subject:(x,y)= then =\KOMAoption{subject}{x, y}=.  If
=subject:x= then =\KOMAoption{subject}{x}=.
If =subject:t= then =\KOMAoption{subject}{...}= is not printed but
\setkomavar{subject}{...} is printed.  If =subject:nil= neither are
printed.
---
 contrib/lisp/ox-koma-letter.el | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 4cb402e..ca20ec7 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -137,7 +137,7 @@ function may be given.  Functions must return a string."
   :group 'org-export-koma-letter
   :type 'string)
 
-(defcustom org-koma-letter-subject-format '("beforeopening" "left" "untitled")
+(defcustom org-koma-letter-subject-format t
   "Use the title as the subject of the letter.  At the time of
 writing the following values are allowed:
 
@@ -162,6 +162,7 @@ English manual of 2012-07-22)"
 		(const  "titled")
 		(const  "untitled")
 		(const :tag "No export" nil)
+		(const :tag "Default options" t)
 		(string))
   :group 'org-export-koma-letter)
 
@@ -432,20 +433,16 @@ holding export options."
    "\\begin{document}\n\n"
    ;; Subject
    (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-format (cond ((member with-subject '("true" "t" t)) nil)
+				((stringp with-subject) (list with-subject))
+				((symbolp with-subject)
+				 (list (symbol-name with-subject)))
+				(t with-subject)))
 	  (subject (org-export-data (plist-get info :title) info))
-	  (l (if (stringp subject-format) 1 (length subject-format)))
+	  (l (length subject-format))
 	  (y ""))
      (concat
-      (when with-subject
+      (when (and with-subject subject-format)
 	(concat
 	 "\\KOMAoption{subject}{"
 	 (apply 'format
-- 
1.8.2.3


  reply	other threads:[~2013-05-25 21:27 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
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                                   ` Rasmus [this message]
2013-05-26 10:58                                     ` [PATCH][ox-koma-letter]: sender, email and cleanup 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=874ndqn42e.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 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).