Re: [O] [PATCH][ox-koma-letter]: sender, email and cleanup
Rasmus writes: Viktor, 1. Viktor's latest patch. 2. The patch describe above that gets user name and email and works on my system. . . Your code works for me. From my point of view, the pros are that per default `org-koma-letter-{author,sender}' pick up the values of `user-full-name' and `user-mail-address' whenever they are changed. That's very nice! The cons are that IHMO it's quite complicated for setting something as simple as author and email and you mentioned a possible crash which I did not test further. Could this be tested using `functionp'? Still, I think we should stick with it for now. functionp seems better, yes. I didn't know about it (doh!). Thanks! While it is complicated I think it's OK given our desire to disable author and still have a similar default to ox-latex.el. Also, it allows for arbitrary functions which could potentially determine the name based on the context of the letter (I don't know since it's already initialized in the options-alist). I'll let you and Alan decide. I like this approach. As a side note, I had quite a few problems working with your patches. None of them applied against master, or against my latest patch as you claimed. Right. I was working off of branch and I guess one reasons is that it was against the history of my previoues patches—of which not all was applied to the master, it seems (?). I've now tried to rework the entire thing against the current master and produces simplified patches. I tested them with git am and they work on my system. There are still things I don't understand such as why git wants to re-add the authors in patch 4 but I've spend way to much time on rebasing and understanding git already and my head hurts. It seems to ignore it when using git am. Before applying the patches my git log says commit 847637f4bdacb861723438c1389f1a3bcdac48af Merge: 43cc5be 206762b Author: Nicolas Goaziou n.goaz...@gmail.com Date: Sat May 25 22:03:48 2013 +0200 Merge branch 'maint' Patches: 1. summarizes all changes in author. It uses my solution as mentioned above. 2. full support for after closing keywords. See commit message 3. signature to nil 4. change handling of subject and allow for setting subject in OPTION-line. I'm going to apply the patches. Thanks to both of you for the nice work! Alan
Re: [O] [PATCH][ox-koma-letter]: sender, email and cleanup
Hi Xavier, 1. summarizes all changes in author. It uses my solution as mentioned above. 2. full support for after closing keywords. See commit message 3. signature to nil 4. change handling of subject and allow for setting subject in OPTION-line. I'm going to apply the patches. Thanks to both of you for the nice work! I just update Org/git and install ox-koma-letter lisp file. I have a strange behavior with EMAIL keyword since there will be always a =\setkomavar{fromemail}= command in my LaTeX produced file even if there is no #+EMAIL: keyword on top of my org file. This is slightly different from what I get when I write or not #+AUTHOR: keyword : the =\setkomavar{fromname}= naturally disappears if AUTHOR is not written. Thanks for the quick report, and sorry about the inconvenience. I'm kind of busy this week due to obligations which I must attend to. Could you perhaps set the offending variable to nil for now? Either org-koma-letter-email or the org-koma-letter-use-email or use #+OPTIONS: email:nil. I couldn't see what would be causing the offending behavior straight away. Could you give me an example-file where the behavior fails? Then I'd also be able to test that future changes don't break expected behavior. Also, if time permits please do look over the (hopefully) elaborate changelogs and test that everything works as you expect it to. I do not want to write every time my email in org file header since it is already set in a lco file. But given this problem, the email is always overloaded when exporting to latex/pdf. If you always have an email in you lco file you should disable email publishing. Cheers, Rasmus -- ⠠⠵
Re: [O] [PATCH][ox-koma-letter]: sender, email and cleanup
Hi Xavier, Xavier Garrido wrote: Hi koma-letterers, Patches: 1. summarizes all changes in author. It uses my solution as mentioned above. 2. full support for after closing keywords. See commit message 3. signature to nil 4. change handling of subject and allow for setting subject in OPTION-line. I'm going to apply the patches. Thanks to both of you for the nice work! I just update Org/git and install ox-koma-letter lisp file. I have a strange behavior with EMAIL keyword since there will be always a =\setkomavar{fromemail}= command in my LaTeX produced file even if there is no #+EMAIL: keyword on top of my org file. This is slightly different from what I get when I write or not #+AUTHOR: keyword : the =\setkomavar{fromname}= naturally disappears if AUTHOR is not written. I do not want to write every time my email in org file header since it is already set in a lco file. But given this problem, the email is always overloaded when exporting to latex/pdf. Please check the values of `org-koma-letter-email' and `org-koma-letter-author'. They should be set to nil if you have these settings defined in an LCO file and do not want to set them in the generated TeX sources. I use such a setup and the latest master branch is working for me. Cheers, Viktor I had a look into ox-koma-letter script and even if I saw small differences when dealing with AUTHOR and EMAIL keywords, I am not able to solve solve this discrepancy. Xavier PS: except from this little problem, it works like a charm, so thanks a lot.
Re: [O] [PATCH][ox-koma-letter]: sender, email and cleanup
Hi Viktor, Please check the values of `org-koma-letter-email' and `org-koma-letter-author'. They should be set to nil if you have these settings defined in an LCO file and do not want to set them in the generated TeX sources. I use such a setup and the latest master branch is working for me. Ok these are working. Thanks for your help, Cheers, Xavier
Re: [O] [PATCH][ox-koma-letter]: sender, email and cleanup (was: [PATCH] ox-koma-letter.el: Reintroduce variables removed in commit 832c6fd with proper defaults)
Hi Rasmus, Rasmus wrote: Attached are three patches that goes on top of Viktor's latest patch (I've also attached it here since I rebased stuff and might have changed it by accident). 1. Viktor's latest patch. 2. The patch describe above that gets user name and email and works on my system. . . Your code works for me. From my point of view, the pros are that per default `org-koma-letter-{author,sender}' pick up the values of `user-full-name' and `user-mail-address' whenever they are changed. That's very nice! The cons are that IHMO it's quite complicated for setting something as simple as author and email and you mentioned a possible crash which I did not test further. Could this be tested using `functionp'? Still, I think we should stick with it for now. 3. Cleaning up special-tags functions introduced in ec108f4c3507ed546a564a48b7379355a65aa9f4. It works a lot better now and some of the mess in the template is moved to other functions. I could not apply this. 4. Sets defcustom org-koma-letter-signature nil since that corresponds to default scrlttr2 behavior anyway (p. 183 in the manual). Works for me. As a side note, I had quite a few problems working with your patches. None of them applied against master, or against my latest patch as you claimed. I had to merge in some of the changes of 0002 by hand. I suggest that we nail down the workings of AUTHOR and EMAIL first (should be done now) and then start with clean separate branches branched from master for your subject and heading code. We could even use github for this, what do you think? Cheers, Viktor 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). –Rasmus -- This is the kind of tedious nonsense up with which I will not put From bbaf9a6ddd75368b2143e6b8fb50be64bd66b50d Mon Sep 17 00:00:00 2001 From: Viktor Rosenfeld listuse...@gmail.com Date: Thu, 23 May 2013 00:00:38 +0200 Subject: [PATCH 1/4] ox-koma-letter.el: Reintroduce variables removed in commit 832c6fd with proper defaults. * ox-koma-letter.el (org-koma-letter-author): Dedicated variable to set the KOMA variable fromname; initialized to `user-full-name' using `after-init-hook' if not set explicitly. (org-koma-letter-email): Dedicated variable to set the KOMA variable fromemail; initialized to `user-mail-address' using `after-init-hook' if not set explicitly. (koma-letter): Use dedicated variables for AUTHOR and EMAIL. (org-koma-letter-template): Variable name change. Setting the variables `org-koma-letter-author' and `org-koma-letter-email' to the values of `user-full-name' and `user-mail-address' respectively, allows the user to skip =#+AUTHOR:= and =#+EMAIL:= lines when configuring a letter. However, if the user wishes to set this information in LCO files, these variables need to be set to nil. --- contrib/lisp/ox-koma-letter.el | 37 +++-- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el index 92cf13a..24c1ac5 100644 --- a/contrib/lisp/ox-koma-letter.el +++ b/contrib/lisp/ox-koma-letter.el @@ -82,6 +82,32 @@ :group 'org-export-koma-letter :type 'string) +(defcustom org-koma-letter-author (if (boundp 'org-koma-letter-author) + user-full-name +;; Empty string means not set yet. +) + The sender's name. + +This variable defaults to the value of `user-full-name'. + :group 'org-export-koma-letter + :type 'string) + +(add-hook 'after-init-hook +(lambda () + (if (string= org-koma-letter-author ) +(setq org-koma-letter-author user-full-name + +(defcustom org-koma-letter-email user-mail-address + The sender's email address. + +This variable defaults to the value of `user-mail-address'. + :group 'org-export-koma-letter + :type 'string) + +(add-hook 'after-init-hook +(lambda () + (if (string= org-koma-letter-email ) +(setq org-koma-letter-email user-mail-address (defcustom org-koma-letter-from-address nil Sender's address, as a string. @@ -93,7 +119,6 @@ :group 'org-export-koma-letter :type 'string) - (defcustom org-koma-letter-place nil Place from which the letter is sent. :group 'org-export-koma-letter @@ -207,10 +232,10 @@ content temporarily.) (org-export-define-derived-backend 'koma-letter 'latex :options-alist '((:lco LCO nil org-koma-letter-class-option-file) -(:sender AUTHOR nil org-koma-letter-author) +(:author AUTHOR nil org-koma-letter-author t) (:from-address FROM_ADDRESS nil org-koma-letter-from-address newline) (:phone-number PHONE_NUMBER nil org-koma-letter-phone-number) -(:email EMAIL nil
Re: [O] [PATCH][ox-koma-letter]: sender, email and cleanup
Hi Rasmus, Rasmus wrote: Rasmus ras...@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. I could not apply this either and I am pressed for time right now. Could you resend a diff against the current master? 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? I'm also not a big fan of the title defaulting to the filename. But I think it is a minor issue. What I think is quite useful is setting the subject to the headline of the exported subtree. Wouldn't we also lose this if subject is nil? Cheers, Viktor –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 From 880f99622a4513520d1dd4e110428f18453a3af1 Mon Sep 17 00:00:00 2001 From: rasmus.pank rasmus.p...@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
Re: [O] [PATCH][ox-koma-letter]: sender, email and cleanup
Viktor, 1. Viktor's latest patch. 2. The patch describe above that gets user name and email and works on my system. . . Your code works for me. From my point of view, the pros are that per default `org-koma-letter-{author,sender}' pick up the values of `user-full-name' and `user-mail-address' whenever they are changed. That's very nice! The cons are that IHMO it's quite complicated for setting something as simple as author and email and you mentioned a possible crash which I did not test further. Could this be tested using `functionp'? Still, I think we should stick with it for now. functionp seems better, yes. I didn't know about it (doh!). Thanks! While it is complicated I think it's OK given our desire to disable author and still have a similar default to ox-latex.el. Also, it allows for arbitrary functions which could potentially determine the name based on the context of the letter (I don't know since it's already initialized in the options-alist). I'll let you and Alan decide. As a side note, I had quite a few problems working with your patches. None of them applied against master, or against my latest patch as you claimed. Right. I was working off of branch and I guess one reasons is that it was against the history of my previoues patches—of which not all was applied to the master, it seems (?). I've now tried to rework the entire thing against the current master and produces simplified patches. I tested them with git am and they work on my system. There are still things I don't understand such as why git wants to re-add the authors in patch 4 but I've spend way to much time on rebasing and understanding git already and my head hurts. It seems to ignore it when using git am. Before applying the patches my git log says commit 847637f4bdacb861723438c1389f1a3bcdac48af Merge: 43cc5be 206762b Author: Nicolas Goaziou n.goaz...@gmail.com Date: Sat May 25 22:03:48 2013 +0200 Merge branch 'maint' Patches: 1. summarizes all changes in author. It uses my solution as mentioned above. 2. full support for after closing keywords. See commit message 3. signature to nil 4. change handling of subject and allow for setting subject in OPTION-line. I had to merge in some of the changes of 0002 by hand. I suggest that we nail down the workings of AUTHOR and EMAIL first (should be done now) and then start with clean separate branches branched from master for your subject and heading code. We could even use github for this, what do you think? Yeah, could be better. It's way too hectic with all the patches and keeping track of moving repos. If you think it can ease the burden of collaborating I'm all for it. I tried to make a git repo retaining the history of ox-koma-letter.el, but I ended up with a repo of 42mb even after applying all the garbage collection tips the interweb had to offer. . . I'm indifferent between bitbucket and github btw, but I'd prefer it someone with more git skills would set it up. -Rasmus -- m-mm-mmm- bacon! From bd51fc02a1345cf1005d0137fc0888d301e1089b Mon Sep 17 00:00:00 2001 From: rasmus.pank rasmus.p...@gmail.com Date: Sun, 26 May 2013 16:13:39 +0200 Subject: [PATCH 1/4] * ox-koma-letter.el (org-koma-letter-author): defaults to a function that returns =`user-full-name'= * ox-koma-letter.el (org-koma-letter-email): defaults to a function that returns =`user-mail-address'= Setting the variables `org-koma-letter-author' and `org-koma-letter-email' to the values of `user-full-name' and `user-mail-address' respectively, allows the user to skip =#+AUTHOR:= and =#+EMAIL:= lines when configuring a letter. However, if the user wishes to set this information in LCO files, these variables need to be set to nil. With the old after-init-hook method my user name was always set to . Now org-koma-letter will (i) allow for default nil values (good if you use LCO files); (ii) default to =`user-full-name'= and =`user-mail-address'= like =ox-latex.el=. These values are obtained on-the-fly. The two variables in question can also be strings or functions returning strings. --- contrib/lisp/ox-koma-letter.el | 50 +- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el index 4318db1..7f50530 100644 --- a/contrib/lisp/ox-koma-letter.el +++ b/contrib/lisp/ox-koma-letter.el @@ -80,6 +80,30 @@ :group 'org-export-koma-letter :type 'string) +(defcustom org-koma-letter-author 'user-full-name + The sender's name. + +This variable defaults to calling the function `user-full-name' +which just returns the current `user-full-name'. Alternatively a +string, nil or a function may be given. Functions must return a +string. + :group 'org-export-koma-letter + :type '(radio (function-item user-full-name) + (string) + (function) + (const nil))) + +(defcustom org-koma-letter-email 'org-koma-letter-email + The sender's email
Re: [O] [PATCH][ox-koma-letter]: sender, email and cleanup
Viktor Rosenfeld listuse...@gmail.com writes: I'm also not a big fan of the title defaulting to the filename. But I think it is a minor issue. What I think is quite useful is setting the subject to the headline of the exported subtree. Wouldn't we also lose this if subject is nil? Without knowing the details wrt title: We can control for a special case and call the vanilla title function otherwise. How easy it is to big up this special case? I don't know. –Rasnmus -- Vote for proprietary math!
Re: [O] [PATCH][ox-koma-letter]: sender, email and cleanup
As a side note, I had quite a few problems working with your patches. None of them applied against master, or against my latest patch as you claimed. I had to merge in some of the changes of 0002 by hand. I suggest that we nail down the workings of AUTHOR and EMAIL first (should be done now) and then start with clean separate branches branched from master for your subject and heading code. We could even use github for this, what do you think? . . . Also, a separate place/branch would allow for a common TODO file to keep a record of what we discuss and more importantly what we've concluded on subject X, Y, Z which otherwise might be forgotten. It could also hold a working copy of Viktor's tutorial which then could be updated more frequently. Lot's of explanation (which is my fault) is now hidden in the commit messages. –Rasmus PS: What would be even better would be to keep the source and tutorial in the same file encoring updating. Of course, I'd want the docstrings to be the main documentation still. E.g. using Org-babel or some-other-mechanism. E.g. paredit generates info automatically.
Re: [O] [PATCH][ox-koma-letter]: sender, email and cleanup
Rasmus ras...@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 From 880f99622a4513520d1dd4e110428f18453a3af1 Mon Sep 17 00:00:00 2001 From: rasmus.pank rasmus.p...@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