From mboxrd@z Thu Jan 1 00:00:00 1970 From: Viktor Rosenfeld Subject: Re: [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]) Date: Sat, 25 May 2013 10:05:54 +0200 Message-ID: <20130525080554.GA590@kenny.local> References: <87wqqsd7p8.fsf@pank.eu> <874ndwcyjx.fsf@pank.eu> <20130521170259.GB56408@client199-78.wlan.hu-berlin.de> <87ehd09p6r.fsf@pank.eu> <20130521195413.GA58739@kenny.local> <87vc6b9atm.fsf@pank.eu> <20130522143923.GA61443@kenny.local> <20130522220650.GB68001@kenny.local> <51A0487D.4020809@mpip-mainz.mpg.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([208.118.235.92]:47169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ug9UM-0004Tm-3e for emacs-orgmode@gnu.org; Sat, 25 May 2013 04:06:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ug9UG-0004Si-AC for emacs-orgmode@gnu.org; Sat, 25 May 2013 04:06:06 -0400 Received: from mail-bk0-x233.google.com ([2a00:1450:4008:c01::233]:48202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ug9UF-0004SW-TZ for emacs-orgmode@gnu.org; Sat, 25 May 2013 04:06:00 -0400 Received: by mail-bk0-f51.google.com with SMTP id ji1so790914bkc.10 for ; Sat, 25 May 2013 01:05:58 -0700 (PDT) Content-Disposition: inline In-Reply-To: <51A0487D.4020809@mpip-mainz.mpg.de> 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: Robert Klein Cc: emacs-orgmode@gnu.org, Rasmus Hi Robert, Robert Klein wrote: > Hi, > > FWIW, from a users view it would be nice if: > > - Use Author/Email information from org file > - If not present use information from LCO file > - if neither org file nor LCO file has any information use > user-full-name and user-email-address > > Could this be solved by having several e.g. `setkomavar{fromname}' > and so on in the tex file, so is created as follows: > > > if no #+AUTHOR in org-file and user-full-name is set: > add user-full-name > if #+LCO(s) in org-file: > add LCO file(s) > if #+AUTHOR in org-file: > add \setkomavar{fromname}{#+AUTHOR} > .... same for email > add \setkomavar{signature}{\usekomavar{fromname}} This is what is implemented by the latest patch (http://thread.gmane.org/gmane.emacs.orgmode/72430/focus=72525). > so the result tex file may have: > > > \setkomavar{fromname}{Hans Wurst} > \setkomavar{fromemail}{hans_wurst@example.com} > ... > \setkomavar{fromname}{Reiner Zufall} > \setkomavar{fromemail}{reiner_zufall@example.com} > \setkomavar{signature}{\usekomavar{fromname}} Why do you repeat fromname and fromemail in your example? Cheers, Viktor > This probably isn't a `clean' solution, but should work without a need > to grep LCO files. > > Best regards > Robert > > > On 05/23/2013 12:06 AM, Viktor Rosenfeld wrote: > > Hi Rasmus, > > > > Viktor Rosenfeld wrote: > > > >> Hi Rasmus, > >> > >> Rasmus wrote: > >> > >>> Viktor Rosenfeld writes: > >>> > >>>> Or 5, keep the change from SENDER to AUTHOR but revert the default > >>>> values to `org-koma-letter-*' variables. (Right now the AUTHOR and EMAIL > >>>> lines could be removed because they duplicate the derived latex > >>>> backend.) > >>> > >>> I once had a teacher who talked about the optimal degree of > >>> conservatism (as well speaking positively about being in the infamoues > >>> ivory tower). 5. is fine with me. So I guess the deal is > >>> 1. default value is the same as in ox-latex. > >>> 2. . . . but it's kept in a seperete variable ox-kl variable. > >>> > >>>> I think that switching from SENDER to AUTHOR, keeping the > >>>> `org-koma-letter-{author,email}' variables in the KOMA backend, but > >>>> setting them per default to `user-full-name' and `user-mail-address', > >>>> would solve both your problems and let me keep LCO files. I would then > >>>> simply set these `org-koma-letter-*' variables to `nil' and document > >>>> this setup in the docstring. I'll see tomorrow if this is feasable. > >>> > >>> Does the attached patch work for you (also with ps tags?) > >> > >> It works, but I noticed the following problem: According to the Emacs > >> documentation `user-mail-address' is only set by Emacs after the > >> initialization process has completed and if it is not explicitly set > >> during initialization [1]. So, the defcustom of org-koma-letter-email > >> does not work as expected if the user has not set `user-mail-address' > >> before. Instead it is set to the empty string, which according to the > >> code setting `user-mail-address' means "not set yet." > >> > >> This can be taking care of by using `after-init-hook' as in the example > >> below. It has the added advantage that the value of `user-mail-address' > >> will be picked up regardless of whether it is set before or after > >> require'ing ox-koma-letter. > >> > >> Note that this creates a slight inconsistency with regard to > >> `user-full-name' which is only picked up correctly if it is set before > >> require'ing ox-koma-letter. I've fixed this by a slightly complicated > >> defcustom definition of `org-koma-letter-author' and another > >> after-init-hook. > >> > >> I've also changed the docstring to indicate what are the default values > >> and added the :group and :type flags again. > > > > I've put my changes into a patch against the current master (commit > > 06cdb2d2). Could you check it with your setup? > > > > Cheers, > > Viktor > > > >