From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: [PATCH][ox-koma-letter]: sender, email and cleanup Date: Sat, 25 May 2013 23:27:05 +0200 Message-ID: <874ndqn42e.fsf@pank.eu> References: <87hahrmabq.fsf@pank.eu> <20130525170322.GA734@kenny.local> <87bo7zlzln.fsf_-_@pank.eu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:60302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UgLzl-0005iX-IW for emacs-orgmode@gnu.org; Sat, 25 May 2013 17:27:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UgLzk-0001u2-6r for emacs-orgmode@gnu.org; Sat, 25 May 2013 17:27:21 -0400 Received: from plane.gmane.org ([80.91.229.3]:46482) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UgLzj-0001tx-SV for emacs-orgmode@gnu.org; Sat, 25 May 2013 17:27:20 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UgLzh-0007Ty-UH for emacs-orgmode@gnu.org; Sat, 25 May 2013 23:27:17 +0200 Received: from dynamic-adsl-94-39-217-165.clienti.tiscali.it ([94.39.217.165]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 25 May 2013 23:27:17 +0200 Received: from rasmus.pank by dynamic-adsl-94-39-217-165.clienti.tiscali.it with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 25 May 2013 23:27:17 +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 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Rasmus 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0005-Only-print-subject-options-when-necessary.patch >From 880f99622a4513520d1dd4e110428f18453a3af1 Mon Sep 17 00:00:00 2001 From: "rasmus.pank" 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 --=-=-=--