From 271c6548aa1f0b61763c30b7116dbb3325364683 Mon Sep 17 00:00:00 2001 From: Viktor Rosenfeld Date: Thu, 23 May 2013 00:00:38 +0200 Subject: [PATCH] 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 4318db1..b56dadb 100644 --- a/contrib/lisp/ox-koma-letter.el +++ b/contrib/lisp/ox-koma-letter.el @@ -80,6 +80,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." @@ -91,7 +117,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 @@ -153,10 +178,10 @@ Use `foldmarks:true' to activate default fold marks or (org-export-define-derived-backend 'koma-letter 'latex :options-alist '((:lco "LCO" nil org-koma-letter-class-option-file) - (:sender "AUTHOR" nil user-full-name t) + (: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 user-mail-address t) + (:email "EMAIL" nil org-koma-letter-email t) (:to-address "TO_ADDRESS" nil nil newline) (:place "PLACE" nil org-koma-letter-place) (:opening "OPENING" nil org-koma-letter-opening) @@ -250,7 +275,7 @@ holding export options." (plist-get info :latex-header-extra)))) info))))) (let ((lco (plist-get info :lco)) - (sender (plist-get info :sender)) + (author (plist-get info :author)) (from-address (plist-get info :from-address)) (phone-number (plist-get info :phone-number)) (email (plist-get info :email)) @@ -264,8 +289,8 @@ holding export options." (setq lco-def (format "%s\\LoadLetterOption{%s}\n" lco-def lco-file))) lco-def)) ;; Define "From" data. - (when sender (format "\\setkomavar{fromname}{%s}\n" - (org-export-data sender info))) + (when author (format "\\setkomavar{fromname}{%s}\n" + (org-export-data author info))) (when from-address (format "\\setkomavar{fromaddress}{%s}\n" from-address)) (when phone-number (format "\\setkomavar{fromphone}{%s}\n" phone-number)) (when email (format "\\setkomavar{fromemail}{%s}\n" email)) -- 1.8.2.3